Page 1 of 1

show warning when SNMP value is empty using check_snmp

Posted: Mon Apr 22, 2013 9:42 am
by sjorda20
I love Nagios.
But I have one more challenge that I can not overcome.

I am using check_snmp to pull GPS location information from a router.
This works fine.
However, If the router can not get a GPS signal I want the service to turn red on my screen.
The problem is that the service stays green because check_snmp is able to successfully pull a "null value" .
After some experimentation I have found a way to turn the service to "Unknown" by doing the following:
check_snmp! C <community> -o <OID> -c :

I leave a blank space after the :

Does anyone know what parameters to pass it to generate a "Critical" or "Warning" ?
Thanks

Re: show warning when SNMP value is empty using check_snmp

Posted: Mon Apr 22, 2013 10:27 am
by abrist
You may be able to do a string/regex match on the output of the check. What does a standard output of the plugin look like?
http://nagiosplugins.org/man/check_snmp

Re: show warning when SNMP value is empty using check_snmp

Posted: Mon Apr 22, 2013 2:32 pm
by sjorda20
Unfortunately, the gps coordinates are constantly changing as the router is a mobile device.
Any other thoughts?

Re: show warning when SNMP value is empty using check_snmp

Posted: Mon Apr 22, 2013 3:00 pm
by abrist
Well, you could negate and check for "null".

Re: show warning when SNMP value is empty using check_snmp

Posted: Tue Apr 23, 2013 9:10 am
by sjorda20
Good idea.
How do you check for "null" in check_snmp?

Re: show warning when SNMP value is empty using check_snmp

Posted: Tue Apr 23, 2013 2:11 pm
by abrist
Good question, I would like to assume you could do a string match, but I am having problems setting up an snmp check the returns "null". Do the gps coordinates always return a value with a decimal, comma, colon or other char when working? If so, you string match the char for the check. I will continue attempting to reproduce the "null" issue so I can give the right syntax.

Re: show warning when SNMP value is empty using check_snmp

Posted: Tue Apr 23, 2013 2:16 pm
by sreinhardt
Considering you can get it to return unknown with -c : have you tried -c1: to show when less than 1 its critical? There does not seem to be a great way to check for null specifically with either snmp or negate.