Last active
December 21, 2015 10:39
-
-
Save aweher/6293729 to your computer and use it in GitHub Desktop.
Count PPPoE clients per VLAN in a Cisco BRAS
This file contains hidden or 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
#!/bin/bash | |
if [ $1 ]; then | |
THEFILE=`date +%s` | |
COMMAND=`rsh $1 show pppoe session | grep "VLAN: " | awk '{print $3}' | sed s/:// > /tmp/$THEFILE`; | |
LIST=`cat /tmp/$THEFILE | sort -uh | xargs`; | |
TOTAL=0 | |
for ITEM in $LIST; do | |
CANT=`grep $ITEM /tmp/$THEFILE | wc -l`; | |
echo "VLAN $ITEM has $CANT clients"; | |
TOTAL=$[ $TOTAL + $CANT ]; | |
done | |
rm /tmp/$THEFILE; | |
else | |
echo "Usage: $0 {BRAS_IP}" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment