<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
					xmlns:content="http://purl.org/rss/1.0/modules/content/"
					xmlns:wfw="http://wellformedweb.org/CommentAPI/"
					xmlns:atom="http://www.w3.org/2005/Atom"
				  >
<channel>
<atom:link rel="self"  type="application/rss+xml"  href="http://rulinux.net/rss_from_sect_4_subsect_10_thread_42657"  />
<title>rulinux.net - Форум - Talks - во чо люди делают, визуализация лампочек на свиче</title>
<link>http://rulinux.net/</link>
<description><![CDATA[Портал о GNU/Linux и не только]]></description>
<image><title>rulinux.net - Форум - Talks - во чо люди делают, визуализация лампочек на свиче</title>
<link>http://rulinux.net/</link>
<url>http://rulinux.net/rss_icon.png</url>
</image>
<item>
<title>Re:во чо люди делают, визуализация лампочек на свиче</title>
<link>https://rulinux.net/message.php?newsid=42657&amp;page=1#217684</link>
<guid>https://rulinux.net/message.php?newsid=42657&amp;page=1#217684</guid>
<pubDate>Tue, 20 Sep 2016 19:11:26 +0300</pubDate>
<description><![CDATA[<p>Ебучие марсиане со своими невиданными роутерами засрали весь технический сегмент рунета! </p>]]></description>
</item>
<item>
<title>Re:во чо люди делают, визуализация лампочек на свиче</title>
<link>https://rulinux.net/message.php?newsid=42657&amp;page=1#217680</link>
<guid>https://rulinux.net/message.php?newsid=42657&amp;page=1#217680</guid>
<pubDate>Tue, 20 Sep 2016 13:48:22 +0300</pubDate>
<description><![CDATA[<p>Ну что за напасть?<br><br><fieldset><legend>text</legend><div class="highlight text"><br />
~&gt;swconfig<br />
bash: swconfig: command not found...<br />
~&gt;ethtool<br />
bash: ethtool: command not found...<br />
~&gt;<br />
&nbsp;</div></fieldset> </p>]]></description>
</item>
<item>
<title>Re:во чо люди делают, визуализация лампочек на свиче</title>
<link>https://rulinux.net/message.php?newsid=42657&amp;page=1#217526</link>
<guid>https://rulinux.net/message.php?newsid=42657&amp;page=1#217526</guid>
<pubDate>Mon, 12 Sep 2016 13:58:22 +0300</pubDate>
<description><![CDATA[<p>у мну есть роутер. буду его значит ломать</p>]]></description>
</item>
<item>
<title>Re:во чо люди делают, визуализация лампочек на свиче</title>
<link>https://rulinux.net/message.php?newsid=42657&amp;page=1#217525</link>
<guid>https://rulinux.net/message.php?newsid=42657&amp;page=1#217525</guid>
<pubDate>Mon, 12 Sep 2016 13:33:17 +0300</pubDate>
<description><![CDATA[<p>Чё ты там оптимизировал, если не знаешь как оно работает? :) У себя в dd-wrt я не нашёл /sbin/swconfig (ну и в десктопной федоре, конечно, тоже). </p>]]></description>
</item>
<item>
<title>Re:во чо люди делают, визуализация лампочек на свиче</title>
<link>https://rulinux.net/message.php?newsid=42657&amp;page=1#217524</link>
<guid>https://rulinux.net/message.php?newsid=42657&amp;page=1#217524</guid>
<pubDate>Mon, 12 Sep 2016 13:25:13 +0300</pubDate>
<description><![CDATA[<p>Я еще понимаю по SNMP мониторить, но через шел то зачем ? <br><br>Да и нет нигде sh на роутерах,  окромя всяких  openwrt и прочих wrt-подобных  домашних роутерах.</p>]]></description>
</item>
<item>
<title>Re:во чо люди делают, визуализация лампочек на свиче</title>
<link>https://rulinux.net/message.php?newsid=42657&amp;page=1#217523</link>
<guid>https://rulinux.net/message.php?newsid=42657&amp;page=1#217523</guid>
<pubDate>Mon, 12 Sep 2016 13:10:24 +0300</pubDate>
<description><![CDATA[<p>только, как я понял, это работает лишь на самих свичах, куда надо имешь шелл логин и пароль доступа и логиниться по какомуннить ssh ??</p>]]></description>
</item>
<item>
<title>Re:во чо люди делают, визуализация лампочек на свиче</title>
<link>https://rulinux.net/message.php?newsid=42657&amp;page=1#217522</link>
<guid>https://rulinux.net/message.php?newsid=42657&amp;page=1#217522</guid>
<pubDate>Mon, 12 Sep 2016 13:09:31 +0300</pubDate>
<description><![CDATA[<p>и народ там в каментах уже оптимизировал скриптик ( <a href="http://vitus-wagner.livejournal.com/1214714.html?thread=41586938#t41586938">http://vitus-wagner.livejournal.com/1214714.html?thread=41586938#t41586938</a> )<br><br>=======================<br><br>Чуть обобщил для поддержки других типов портов, добавил цвета:<br><br><fieldset><legend>bash</legend><div class="highlight bash"><br />
<span class="co0">#!/bin/sh</span><br />
<br />
<span class="re2">off</span>=8<br />
<span class="re2">amber</span>=220<br />
<span class="re2">green</span>=10<br />
<br />
check <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re2">out</span>=$<span class="br0">&#40;</span>$1 2<span class="sy0">&gt;/</span>dev<span class="sy0">/</span>null<span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">case</span> <span class="st0">&quot;<span class="es2">$out</span>&quot;</span> <span class="kw1">in</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">*</span>$2<span class="sy0">*</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tput setaf <span class="re1">$off</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">*</span>$3<span class="sy0">*</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tput setaf <span class="re1">$amber</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="sy0">*</span>$4<span class="sy0">*</span><span class="br0">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; tput setaf <span class="re1">$green</span> <span class="sy0">;;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">esac</span><br />
<span class="br0">&#125;</span><br />
<br />
method_swc <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; check <span class="st0">&quot;/sbin/swconfig dev $1 port $2 get link&quot;</span> <span class="kw2">link</span>:down speed:100baseT speed:1000baseT<br />
<span class="br0">&#125;</span><br />
<br />
method_etht <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; check <span class="st0">&quot;/sbin/ethtool $1&quot;</span> <span class="st_h">'Link detected: no'</span> <span class="st_h">'Speed: 100Mb/s'</span> <span class="st_h">'Speed: 1000Mb/s'</span><br />
<span class="br0">&#125;</span><br />
<br />
get <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="re2">method</span>=$1<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">shift</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; method_<span class="re1">$method</span> <span class="st0">&quot;$@&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">echo</span> <span class="re5">-n</span> <span class="st_h">'■ '</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; tput sgr0<br />
<span class="br0">&#125;</span><br />
<br />
draw <span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">echo</span> <span class="st_h">'┌───────────────────────────┐'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">echo</span> <span class="st0">&quot;│ &nbsp;$1 $2 $3 $4 &nbsp;$5 &nbsp; $6 &nbsp; &nbsp; │&quot;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">echo</span> <span class="st_h">'└───────────────────────────┘'</span><br />
<span class="br0">&#125;</span><br />
<br />
draw <span class="st0">&quot;<span class="es4">$(get swc switch0 2)</span>&quot;</span> \<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;<span class="es4">$(get swc switch0 1)</span>&quot;</span> \<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;<span class="es4">$(get swc switch0 0)</span>&quot;</span> \<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;<span class="es4">$(get swc switch0 4)</span>&quot;</span> \<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;<span class="es4">$(get swc switch0 3)</span>&quot;</span> \<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span class="st0">&quot;<span class="es4">$(get etht usb0)</span>&quot;</span><br />
<br />
&nbsp;</div></fieldset></p>]]></description>
</item>
<item>
<title>во чо люди делают, визуализация лампочек на свиче</title>
<link>https://rulinux.net/message.php?newsid=42657&amp;page=1#217521</link>
<guid>https://rulinux.net/message.php?newsid=42657&amp;page=1#217521</guid>
<pubDate>Mon, 12 Sep 2016 13:08:25 +0300</pubDate>
<description><![CDATA[<p><a href="http://vitus-wagner.livejournal.com/1214714.html">http://vitus-wagner.livejournal.com/1214714.html</a><br><br>Тут благодаря идее yurikhan написал себе шелловский скриптик, который рисует на экране морду свитча с горящими (или не горящими) лампочками линков. Вот так:<br><br><fieldset><legend>text</legend><div class="highlight text"><br />
vitus@alcor$ ./switchface <br />
+----------------------+<br />
| (o) &nbsp; (O) (o) (O) ( )|<br />
+----------------------+<br />
&nbsp;</div></fieldset><br><br> Чтобы не надо было идти в коридор, открывать шкаф, и залезать на стул, чтобы увидеть физические лампочки.<br><br>Большая буква O - это 1000baseT, маленькая o - 100baseT. Факт наличия full-duplex решил пока не отображать.<br><br> <fieldset><legend>text</legend><div class="highlight text"><br />
#!/bin/bash<br />
declare -a p<br />
for i in `seq 0 4`; do<br />
&nbsp; &nbsp;msg=`/sbin/swconfig dev switch0 port $i get link`<br />
&nbsp; &nbsp;case &quot;$msg&quot; in<br />
&nbsp; &nbsp; &nbsp; &nbsp; *link:down*)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p[$i]=&quot; &quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; *speed:100baseT*)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p[$i]=&quot;o&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; *speed:1000baseT*)<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; p[$i]=&quot;O&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ;;<br />
&nbsp; &nbsp;esac<br />
done<br />
<br />
echo '+----------------------+'<br />
echo &quot;| (${p[3]}) &nbsp; (${p[4]}) (${p[0]}) (${p[1]}) (${p[2]})|&quot;<br />
echo '+----------------------+'<br />
<br />
&nbsp;</div></fieldset></p>]]></description>
</item>
</channel>
</rss>