Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Simple(ish) hacked up bandwidth logger
#!/bin/bash
#Makes a CSV of UNIX Time, wget speed, and link speed from an SNMP router
TEMPFILE="/tmp/10m"
STARTBYTES=`snmpwalk -OvQ -v2c -c SNMPRO ROUTERIP 1.3.6.1.2.1.2.2.1.10.7`
STARTTIME=`date +%s`
WGETOUTPUT=`/usr/bin/wget -O$TEMPFILE "http://mirror.internode.on.net/pub/test/10meg.test" 2>&1`
FINISHBYTES=`snmpwalk -OvQ -v2c -c SNMPRO ROUTERIP 1.3.6.1.2.1.2.2.1.10.7`
FINISHTIME=`date +%s`
BPS=`echo \(\($FINISHBYTES-$STARTBYTES\)/\($FINISHTIME-$STARTTIME\)\)/1024|/usr/bin/bc`
DATALINE=`echo $WGETOUTPUT | /usr/bin/perl -ne 'print "$1 $2" if /.*(?:\()([0-9]+) (KB|MB)\/s(?:\)).*/' `
echo $STARTTIME,$DATALINE,$BPS KB >> bandwidth.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.