Check_SNMP Interpreting Warnings and Criticals

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
CountryLife08
Posts: 11
Joined: Sun Dec 14, 2014 3:02 pm

Check_SNMP Interpreting Warnings and Criticals

Post by CountryLife08 »

Hey All,

So we fixed the issue from this post http://support.nagios.com/forum/viewtop ... =7&t=30535 and then when unknown timeouts occurred we fixed that by adding a -t to the command line and gave a 30 second timeout and Nagios saw the non responsive equipment as Critical (a forum suggestion). So what brought me back to this post is that for all of our buildings we utilize a gateway server for guest access so that when we have meetings, family, or visitors of any kind they can access the network temporarily. So I was running an SNMP check to make sure that the registration service (AAA) is enabled on the servers. The problem I hit is that the server responds to services as enabled or disabled (1 or 0). So when I run this code

Code: Select all

check_command        check_snmp!-C MEMPHISpublic -o SERVER-MIB::aaaOn.0
Nagios returns and shows "SNMP OK - 1" which tells me that the service is on. So I added a -c 1 to the end of the code.

Code: Select all

check_command        check_snmp!-C MEMPHISpublic -o SERVER-MIB::aaaOn.0 -c 1
and then turned the service off and it appeared as "SNMP OK - 0" which tells me the service was off, but with the rules of Nagios programing applied (assuming I understand those correctly, I think I do but its iffy) Nagios saw the 0 status code and said OK because 0 typically means OK, 1 is usually a warning, and 2 is critical.

I re-read the forum post and I think I may be missing something basic, I am way over thinking everything. I added the "-r 1" regex to tell Nagios to look for a "1" and to output a warning if a 2 is found "-w 2" and to go critical if it finds a zero "-c 0" so the end result appeared this way.

Code: Select all

check_command        check_snmp!-C MEMPHISpublic -o SERVER-MIB::aaaOn.0 -r 1 -w 2 -c 0
but Nagios still comes back with "SNMP OK - 0". Can you point me in the direction of my misunderstanding/problem?


Thank you,
CountryLife08 (J)
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Check_SNMP Interpreting Warnings and Criticals

Post by Box293 »

You're on the right path with the regex stuff. When you use regex, you don't need the warning and critical argument. I think that these other arguments are overriding the regex argument.

I did some tests and all you should need is -r 1

Heres an OID that has the value of 1:

Code: Select all

Command:
./check_snmp -H 10.25.40.10 -C public -o iso.3.6.1.4.1.4526.11.1.2.1.5.5.0 -r 1

Output:
SNMP OK - 1 | SNMPv2-SMI::enterprises.4526.11.1.2.1.5.5.0=1
Heres an OID that has the value of 0:

Code: Select all

Command:
./check_snmp -H 10.25.40.10 -C public -o iso.3.6.1.4.1.4526.11.1.2.1.6.2.0 -r 1

Output:
SNMP CRITICAL - *0* | SNMPv2-SMI::enterprises.4526.11.1.2.1.6.2.0=0
Edit:
After thinking about this some more, I believe you identified a bug so I have logged this as an issue on GitHib:
https://github.com/nagios-plugins/nagio ... /issues/75

The solution above is still correct, but technically you should be able to use the -w or -c arguments. The issue appears to exist when the returned value is 0.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked