dslreports logo
site
 
    All Forums Hot Topics Gallery
spc

spacer




how-to block ads


Search Topic:
uniqs
7
share rss forum feed


houkouonchi

join:2002-07-22
Ontario, CA
Reviews:
·Verizon FiOS

1 recommendation

reply to Dream Killer

Re: Tx/Rx rate in MI424wr telnet?

I did something similar for a guy running a westell router (i forget the model) Just used ifconfig output (which reset every 4 GB with MRTG which expected this behavior).

Had a stand-alone shell script that just dumped some info to a text file and parsed that:

vz_ifconfig.sh:

#!/bin/sh
/usr/bin/expect << EOF
set timeout 20
spawn /usr/bin/telnet targetip targetport
expect "Username: "
send "bandwidth\r"
expect "Password: "
send "thepassword\r"
expect "Wireless Broadband Router> "
send "system shell\r"
expect "/ #"
send "ifconfig\r"
expect "/ #"
send "uptime\r"
expect "/ #"
send "exit\r"
expect "Wireless Broadband Router> "
send "exit\r"
exit
EOF
 

And the script that MRTG called:

vz_bytes.sh:
#!/bin/sh
tmp=/stats/vz_ifconfig.txt
/stats/vz_ifconfig.sh > $tmp
bytes=`cat $tmp  | grep -A6 eth1 | tail -n 1 | /usr/bin/awk '{print $2" "$6}' | /usr/bin/awk -F "bytes:" '{print $2 $3}'`
rx=`echo $bytes | /usr/bin/awk '{print $1}'`
tx=`echo $bytes | /usr/bin/awk '{print $2}'`
uptime=`cat $tmp | grep load |  /usr/bin/awk -F "up " '{print $2}' | /usr/bin/awk -F ", load" '{print $1}'`
echo $rx
echo $tx
echo $uptime
echo "Home Network"
 

--
300/150 mbit Bonded Verizon FiOS connection FTW!