Linux.com

Remote Router

Posted by: Anonymous Coward on March 13, 2006 09:47 PM
More frequently, I need to monitor traffic across our gateway (router) rather than my local box.

For that I basically do:
<tt>  one=`snmpget 192.168.0.1 ifInOctets`
  while true; do
    sleep 1
    two=`snmpget ifInOctets`
    echo "($two - $one) * 8" | bc
    one=$two
  done</tt>
and<nobr> <wbr></nobr>/Voila!/ it gives me a running display of bits per second. [In reality, I track ifOutOctets as well, of course -- and "snmpget" requires more arguments. Fleshing that out is left as an exercise for the reader.]

#

Return to CLI Magic: Monitoring bandwidth from the command line