show warning when SNMP value is empty using check_snmp

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
sjorda20
Posts: 4
Joined: Mon Apr 22, 2013 9:31 am

show warning when SNMP value is empty using check_snmp

Post 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
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: show warning when SNMP value is empty using check_snmp

Post 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
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
sjorda20
Posts: 4
Joined: Mon Apr 22, 2013 9:31 am

Re: show warning when SNMP value is empty using check_snmp

Post by sjorda20 »

Unfortunately, the gps coordinates are constantly changing as the router is a mobile device.
Any other thoughts?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: show warning when SNMP value is empty using check_snmp

Post by abrist »

Well, you could negate and check for "null".
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
sjorda20
Posts: 4
Joined: Mon Apr 22, 2013 9:31 am

Re: show warning when SNMP value is empty using check_snmp

Post by sjorda20 »

Good idea.
How do you check for "null" in check_snmp?
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: show warning when SNMP value is empty using check_snmp

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: show warning when SNMP value is empty using check_snmp

Post 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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
Locked