Page 1 of 1

Check_SNMP returns integer, XI needs results defined

Posted: Thu Jul 28, 2011 12:14 pm
by BanditBBS
I am using check_snmp to check the status of some UPS's. I get results back of an integer of 1,2,3,4 or 5. No matter what returns Nagios is saying the service is OK. I want to tell Nagios that:
1=unknown
2=Ok
3=Critical
any other=warning

It has been way to long since I did this last, I can not remember where/how to do this. Can anyone give me a quick hint.

Re: Check_SNMP returns integer, XI needs results defined

Posted: Thu Jul 28, 2011 1:38 pm
by nscott
You would actually have to edit the plugins to achieve some of these aims, and since the check_snmp plugin is compiled C, you'll have to grab the source code, however, you can achieve most of these aims by using the command flags. (Reference here: http://nagiosplugins.org/man/check_snmp )

The Unknowns statuses are hard coded into the script, so I won't be able to help you there. Your situation sounds pretty specific, and this plugin doesn't offer -w and -c @ ranging support so you'll have to find the string that the SNMP is returning, which can't afford you a Warning status. Give this a try:

./check_snmp -H <host IP> -C <community string> -o <OID> -s '<string SNMP plugin will return to signify OK status>'

Re: Check_SNMP returns integer, XI needs results defined

Posted: Thu Jul 28, 2011 2:04 pm
by BanditBBS
Good enough for me, adding the -s '2' makes anything but 2 come up as critical, that'll work for my situation, thanks for the help.

Re: Check_SNMP returns integer, XI needs results defined

Posted: Thu Jul 28, 2011 4:44 pm
by nscott
Anytime, good luck!