<rant>
Notice, this email contains HTML formatting, if you are offended by such technology (or you use mutt), dont read this email :p
</rant>

Please excuse a noob in SNMP but I need to resolve this issue quickly, so here it goes.
I have a Linksys router operating in "Gateway" mode and I need to find out when the ADSL connection dies using SNMP so that Nagios won't send a million SMS message to my mobile late at night >:(
here is the snmpwalk on the router

# snmpwalk -v 2c -c public 192.168.1.1 .1.3.6.1.2.1.2.2
IF-MIB::ifIndex.1 = INTEGER: 1
IF-MIB::ifIndex.3 = INTEGER: 3
IF-MIB::ifIndex.4 = INTEGER: 4
IF-MIB::ifIndex.5 = INTEGER: 5
IF-MIB::ifIndex.6 = INTEGER: 6
IF-MIB::ifIndex.7 = INTEGER: 7
IF-MIB::ifIndex.8 = INTEGER: 8
IF-MIB::ifDescr.1 = STRING: lo
IF-MIB::ifDescr.3 = STRING: ixp0
IF-MIB::ifDescr.4 = STRING: ixp1
IF-MIB::ifDescr.5 = STRING: eth0
IF-MIB::ifDescr.6 = STRING: br0
IF-MIB::ifDescr.7 = STRING: ppp0
IF-MIB::ifDescr.8 = STRING: ipsec0
IF-MIB::ifType.1 = INTEGER: softwareLoopback(24)
IF-MIB::ifType.3 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.4 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.5 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.6 = INTEGER: ethernetCsmacd(6)
IF-MIB::ifType.7 = INTEGER: ppp(23)
IF-MIB::ifType.8 = INTEGER: ppp(23)


and here is the ifAdminStatus and ifOperStatus dump


IF-MIB::ifAdminStatus.1 = INTEGER: up(1)
IF-MIB::ifAdminStatus.3 = INTEGER: up(1)
IF-MIB::ifAdminStatus.4 = INTEGER: up(1)
IF-MIB::ifAdminStatus.5 = INTEGER: up(1)
IF-MIB::ifAdminStatus.6 = INTEGER: up(1)
IF-MIB::ifAdminStatus.7 = INTEGER: up(1)
IF-MIB::ifAdminStatus.8 = INTEGER: up(1)
IF-MIB::ifOperStatus.1 = INTEGER: up(1)
IF-MIB::ifOperStatus.3 = INTEGER: up(1)
IF-MIB::ifOperStatus.4 = INTEGER: up(1)
IF-MIB::ifOperStatus.5 = INTEGER: up(1)
IF-MIB::ifOperStatus.6 = INTEGER: up(1)
IF-MIB::ifOperStatus.7 = INTEGER: up(1)
IF-MIB::ifOperStatus.8 = INTEGER: up(1)


now that sounds pretty easy and logical, the ifOperStatus should tell you if an interface is up or down, and thats confirmed by Cisco's OID tree (http://tools.cisco.com/Support/SNMP/do/BrowseOID.do?local=en&translate=Translate&objectInput=1.3.6.1.2.1.2.2.1 )


but the problem is that if the connection dies, all the ifOperStatus values stay (1) which means up!

here is the script that I use to check for the connection status

#!/bin/bash

RESULT=`snmpwalk -v 2c -c public 192.168.1.1 .1.3.6.1.2.1.2.2.1.8 | awk -F\( '{ print $2 }' | awk -F\) '{ print $1 }' | grep -v 1`

if [ -z "$RESULT" ]; then
        echo -e "OK, Connection ON"
        exit 0
else
        echo -e "CRITICAL, Connection OFF"
        echo -e "connection died" > /tmp/connection_died
        exit 1
fi


this script checks the ifOperStatus on ALL the interfaces, a desperate measure on my part.

help?!


--
---------------------------
Netiquette -> http://www.dtcc.edu/cs/rfc1855.html
http://tumbak.at.preempted.net
---------------------------
_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org

Reply via email to