I'm reading Monitoring Routers and Switches page, in particular "Monitoring SNMP Status Information" section.


In the example above, the "-o ifOperStatus.1" refers to the OID for the operational status of port 1 on the switch. The "-r 1" option tells the check_snmp plugin to return an OK state if "1" is found in the SNMP result (1 indicates an "up" state on the port) and CRITICAL if it isn't found. The "-m RFC1213-MIB" is optional and tells the check_snmp plugin to only load the "RFC1213-MIB" instead of every single MIB that's installed on your system, which can help speed things up.

So, I'm trying out their example:

# /usr/lib/nagios/plugins/check_snmp --hostname=X.X.X.X --community=X --protocol=X --oid=ifOperStatus.5 -r1 -m RFC1213-MIB
SNMP OK - 1 | RFC1213-MIB::ifOperStatus.5=1 

interface returns SNMP OK - 1 - interface is "up". I took another of interface down and ran same command for that interface.

# /usr/lib/nagios/plugins/check_snmp --hostname=X.X.X.X --community=X --protocol=X --oid=ifOperStatus.6 -r1 -m RFC1213-MIB
SNMP OK - 2 | RFC1213-MIB::ifOperStatus.6=2 
# snmpwalk -Os -cX -vX X ifOperStatus.6
ifOperStatus.6 = INTEGER: down(2)

returns SNMP OK - 2 - interface is down

I can't figure out how to get -r1 to work properly, because even though it sees that interface is down, it passes to Nagios as its OK. Any ideas what am I doing wrong?

  • check_snmp v1.4.15 (nagios-plugins 1.4.15) – alexus Jan 10 '14 at 20:30
  • no, sorry( I don't feel comfortable running executable from a 3rd party sites on my computer, not to mention it may not be even compatible w/ my system at the first place. – alexus Jan 10 '14 at 21:58
  • there seems to be a bug (or I'm doing something really wrong) -r1 isn't working for me, I was able to get it going through -c1 instead. – alexus Jan 10 '14 at 22:04
  • @user2196728 don't get so disappointed) it only makes sense NOT to run executable from sources that you don't trust)) – alexus Jan 10 '14 at 22:10

as "work around" (even though it really not), one can use -c or -w instead of -r, as -r seems to have some sort of bug.

# ./check_snmp --help | grep -E 'critical|warning'
 -w, --warning=THRESHOLD(s)
 -c, --critical=THRESHOLD(s)


# /usr/lib/nagios/plugins/check_snmp --hostname=X.X.X.X --community=X --protocol=X --oid=ifOperStatus.6 -c1
SNMP CRITICAL - *2* | IF-MIB::ifOperStatus.5=2 
  • .. same thing, I think the problem is it doesn't do ANY matching at all, I can do -ruser2196728 and it'll still say OK – alexus Jan 10 '14 at 22:27
  • @user2196728 yeah, I already found it too) so I was right, it IS a bug) – alexus Jan 10 '14 at 22:29
  • dude, take it easy there) you going give yourself a heart attack( i was trying to get it going and I wasn't sure 100% if I was doing it right or wrong so I came here to ask community (which you're part of) at the end of the day solution is in place, so it's all good). I'd like to thank YOU personally for your time and help) – alexus Jan 10 '14 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.