nagios check_snmp ifoperstatus not OK

13,193

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)
# 

example:

# /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 
#
Share:
13,193
alexus
Author by

alexus

Consulting | alexus.biz Dmitry Chorine | LinkedIn a1exus (a1exus) on Twitter Verify a Red Hat Certified Professional | redhat.com

Updated on September 18, 2022

Comments

  • alexus
    alexus over 1 year

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

    quote:

    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?

    • alexus
      alexus over 10 years
      check_snmp v1.4.15 (nagios-plugins 1.4.15)
    • alexus
      alexus over 10 years
      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
      alexus over 10 years
      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
      alexus over 10 years
      @user2196728 don't get so disappointed) it only makes sense NOT to run executable from sources that you don't trust))
  • alexus
    alexus over 10 years
    .. 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
    alexus over 10 years
    @user2196728 yeah, I already found it too) so I was right, it IS a bug)
  • alexus
    alexus over 10 years
    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)