Created
December 21, 2015 20:40
-
-
Save lanrat/7d22c7c07a9b0da4e68a to your computer and use it in GitHub Desktop.
DD-WRT SNMP bandwidth
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
HOST=192.168.1.1 | |
IFACE_ID=3 | |
SAMPLE=5 | |
## iface | |
NAME=$(snmpget -v 2c -c public -O q $HOST iso.3.6.1.2.1.2.2.1.2.$IFACE_ID | cut -d ' ' -f2) | |
echo "Bandwidth for $NAME" | |
## bytes | |
D1=$(snmpget -v 2c -c public -O q $HOST iso.3.6.1.2.1.2.2.1.10.$IFACE_ID | cut -d ' ' -f2) | |
U1=$(snmpget -v 2c -c public -O q $HOST iso.3.6.1.2.1.2.2.1.16.$IFACE_ID | cut -d ' ' -f2) | |
sleep $SAMPLE | |
D2=$(snmpget -v 2c -c public -O q $HOST iso.3.6.1.2.1.2.2.1.10.$IFACE_ID | cut -d ' ' -f2) | |
U2=$(snmpget -v 2c -c public -O q $HOST iso.3.6.1.2.1.2.2.1.16.$IFACE_ID | cut -d ' ' -f2) | |
D=$((($D2-$D1)/$SAMPLE)) | |
U=$((($U2-$U1)/$SAMPLE)) | |
echo "Down ${D} bytes/seccond" | |
echo "Up ${U} bytes/seccond" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment