Public domain
#!/bin/bash
# $1 = E1 Channels (8 * 30 = 240)
# $2 = Router IP
# $3 = SNMP Community
/usr/bin/snmpwalk -c $3 -v 2c $2 ifOperStatus > online.tmp
ONLINE=$(/usr/bin/tail -n $1 online.tmp | /usr/bin/grep up | /usr/bin/wc -l)
UPTIME=$(uptime | sed -e 's,\,.*,,' -e 's,.*up ,,')
HOSTNAME=$(hostname)
/usr/bin/rm online.tmp
echo $ONLINE
echo $ONLINE
echo $UPTIME
echo $HOSTNAME
workdir: /var/www/htdocs/mrtg
Target[online1]: `/usr/local/mrtg-2/etc/cisco-online.sh 240 192.168.1.21 public`
Options[online1]: gauge, nopercent, integer
Title[online1]: Online User statistics AS5300-1
PageTop[online1]: <H1>Online User Statistics AS5300-1</H1>
YLegend[online1]: # of Users
ShortLegend[online1]: users
Colours[online1]: YELLOW#F9C000,RED#F90000,DARKGREEN#006600,VIOLET#FF00FF
Legend1[online1]: Cisco MIB
Legend2[online1]:
LegendI[online1]: Users
LegendO[online1]:
MaxBytes[online1]: 1000
Target[online2]: `/usr/local/mrtg-2/etc/cisco-online.sh 240 192.168.1.20 public`
Options[online2]: gauge, nopercent, integer
Title[online2]: Online User statistics AS5300-2
PageTop[online2]: <H1>Online User Statistics AS5300-2</H1>
YLegend[online2]: # of Users
ShortLegend[online2]: users
Colours[online2]: YELLOW#F9C000,RED#F90000,DARKGREEN#006600,VIOLET#FF00FF
Legend1[online2]: Cisco MIB
Legend2[online2]:
LegendI[online2]: Users
LegendO[online2]:
MaxBytes[online2]: 1000
BY: Pejman Moghadam
TAG: mrtg, cisco
DATE: 2009-06-12 06:30:49