Page 1 of 1
check_snmp always returns OK
Posted: Wed Aug 29, 2012 6:57 am
by V3xX
Hello
We got problems with check_snmp plugins.
I start a query to get the status of a environment and it returns a 1 if its critical and a 2 if its ok.
The command in Nagios looks like:
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.318.1.1.10.4.3.2.1.5.0.3 -s 2
It should return a critical if the query doesn't result a 2.
But it always returns OK (whetever it returns 1 or 2).
This happens since we upgradet to Nagios Core 3.2.3
before we had something with 2.x.x
can someone please help me in this case?
thanks in advance and kind regards
V3xX
Re: check_snmp always returns OK
Posted: Wed Aug 29, 2012 5:27 pm
by jsmurphy
I vaguely remember another post about this... from memory you needed to add quotes around the text to explicitly define it as a string. I also think that -s needs to match the whole return string not just part of it.
So you can try:
Code: Select all
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.318.1.1.10.4.3.2.1.5.0.3 -s '2'
If that doesn't work then:
Code: Select all
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.318.1.1.10.4.3.2.1.5.0.3 -r 2
Should work. Using -r specifies that it's a regular expression and will match part of the string.
Re: check_snmp always returns OK
Posted: Thu Aug 30, 2012 2:05 am
by V3xX
Thanks for your help.
I tried both of your two examples, both didn't work...
I also tried this
Code: Select all
command_line $USER1$/check_snmp -H $HOSTADDRESS$ -C public -o .1.3.6.1.4.1.318.1.1.10.4.3.2.1.5.0.3 -r '2'
someone has a older Nagios Core (2.x.x), who can get me the check_snmp?
I didn't find it anywhere on internet.
Maybe it helps, if i change this plugin.
Has someone any other ideas?
Thanks and kind regards
V3xX
Re: check_snmp always returns OK
Posted: Thu Aug 30, 2012 4:55 pm
by jsmurphy
Check_snmp and all the other plugins are not actually part of Nagios, they are a separate package maintained by different developers. You can find all versions of the nagios-plugins package on the development teams source-forge:
http://sourceforge.net/projects/nagiosp ... agiosplug/
It might also be worth asking the question on the dev teams support mailing list, so that if there is a legitimate bug they can fix it:
http://nagiosplugins.org/support
Re: check_snmp always returns OK
Posted: Fri Aug 31, 2012 1:58 am
by V3xX
I don't get it -.-
I've downloaded different versions.
But i can't compile the C-Scripts...
Has someone a compiled one of the check_snmp plugin?
Thanks and kind regards
V3xX
Re: check_snmp always returns OK
Posted: Tue Sep 04, 2012 12:18 am
by V3xX
Any new information?
Can't find something on internet....
kind regards
V3xX
Re: check_snmp always returns OK
Posted: Tue Sep 04, 2012 2:15 pm
by slansing
The SNMP check should still behave the same with the latest version of Nagios Core, what did you get when you tried what Jsmurphy suggested?
Re: check_snmp always returns OK
Posted: Wed Sep 05, 2012 12:40 am
by V3xX
Hi slansing,
I tried many different ways to get a correct syntax.
Everytime it returned OK if there was a 1 or a 2 as result.
kind regards
V3xX
Re: check_snmp always returns OK
Posted: Thu Sep 06, 2012 2:36 am
by V3xX
replace check_snmp with a newer version solved the problem
thanks everyone for your help!
kind regards
V3xX
Re: check_snmp always returns OK
Posted: Thu Sep 06, 2012 5:00 pm
by jsmurphy
Glad you got it sorted out.