<br><br><div class="gmail_quote">On Sat, Jan 26, 2013 at 10:22 AM, Dave Taht <span dir="ltr"><<a href="mailto:dave.taht@gmail.com" target="_blank">dave.taht@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Once upon a time it was possible to write quick and dirty tools in shell. You used to just be able to open a port, write a tiny little daemon, and go. And we used to have handy tools like rwho and finger to figure out who was online, ruptime to check uptime, etc, etc.<br>
<br>That's too insecure nowadays...<br>so we have 3 different levels of snmp which you can use (if you can secure it), and<br>run a shell command from that, remotely, then parse... or use ssh, and parse.<br><br>And then we have dhcp, which hands out leases, but is not tied to how wifi goes up<br>
and down.<br><br>This morning I had a need to figure who was actually on a couple cerowrt APs,<br>and a few statistics as to their connected rate... <br><br>I haven't got so as figuring out how to do all that via snmpd yet, but as this uses<br>
an obscure feature of the mac802.11 stack, I thought I'd document this much.<br><br>If there is a better way, a mib, something, let me know....<br clear="all"><br>#!/bin/sh<br># rup: quickly see whos really on the wifi<br>
<br>A=`ls /sys/kernel/debug/ieee80211/phy*/netdev:*/stations | \<br> cut -f8 -d/ | tr '\n' '|'`<br># cut off last |<br>egrep ${A%?} /tmp/dhcp.leases | awk '{print $3 " " $4 }'<span><font color="#888888"><br>
<br><br></font></span></blockquote><div><br>Or, you can just stick it into /etc/xinetd.d/rup<br><br>service rup<br>{<br> disable = no<br> socket_type = stream<br> wait = no<br>
user = nobody<br>
only_from = my_ipv4_ip/32 my_ipv6_ip/64<br> port = 79<br> type = UNLISTED<br> server = /etc/rup<br> flags = IPv6<br> log_on_success += HOST USERID<br>
log_on_failure += HOST USERID<br> instances = 4<br>}<br><br><br>nc 172.20.2.2 79 | awk '{print $1}' | fping -c 2 -q<br><br>and be done with it.<br><br>172.20.3.210 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 6.64/187/368<br>
172.20.3.99 : xmt/rcv/%loss = 2/0/100%<br>172.20.3.180 : xmt/rcv/%loss = 2/0/100%<br>172.20.3.141 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 75.1/77.9/80.7<br>172.20.3.212 : xmt/rcv/%loss = 2/0/100%<br>172.20.3.128 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 23.9/122/222<br>
172.20.3.229 : xmt/rcv/%loss = 2/0/100%<br>172.20.3.172 : xmt/rcv/%loss = 2/0/100%<br>172.20.3.34 : xmt/rcv/%loss = 2/0/100%<br>172.20.3.102 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0.07/0.08/0.09<br>172.20.3.146 : xmt/rcv/%loss = 2/0/100%<br>
<br>and to gather remote rate stats:<br><br>#!/bin/sh<br># Gather connected speeds and minstrel error rates from remote wifi<br><br>for i in /sys/kernel/debug/ieee80211/phy*/netdev:*/stations/*<br>do<br> RATE=`grep PMCS "$i/rc_stats"`<br>
STATION=`echo $i | cut -f9 -d/`<br> [ -z "$STATION" ] && exit<br> B=`grep ${STATION} /tmp/dhcp.leases 2> /dev/null | awk '{print $3}'`<br> echo "$B $RATE"<br>
done<br><br># and I suppose this will blow up in ipv6...<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span><font color="#888888">
<br><br>-- <br>Dave Täht<br><br>Fixing bufferbloat with cerowrt: <a href="http://www.teklibre.com/cerowrt/subscribe.html" target="_blank">http://www.teklibre.com/cerowrt/subscribe.html</a>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>Dave Täht<br><br>Fixing bufferbloat with cerowrt: <a href="http://www.teklibre.com/cerowrt/subscribe.html" target="_blank">http://www.teklibre.com/cerowrt/subscribe.html</a>