check_snmp always returns OK

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
V3xX
Posts: 26
Joined: Wed Aug 29, 2012 6:48 am
Location: Switzerland

check_snmp always returns OK

Post 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
Last edited by V3xX on Thu Sep 06, 2012 2:36 am, edited 1 time in total.
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_snmp always returns OK

Post 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.
V3xX
Posts: 26
Joined: Wed Aug 29, 2012 6:48 am
Location: Switzerland

Re: check_snmp always returns OK

Post by V3xX »

Thanks for your help.

I tried both of your two examples, both didn't work... :evil:

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
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_snmp always returns OK

Post 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
V3xX
Posts: 26
Joined: Wed Aug 29, 2012 6:48 am
Location: Switzerland

Re: check_snmp always returns OK

Post 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
V3xX
Posts: 26
Joined: Wed Aug 29, 2012 6:48 am
Location: Switzerland

Re: check_snmp always returns OK

Post by V3xX »

Any new information?

Can't find something on internet....


kind regards
V3xX
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_snmp always returns OK

Post 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?
V3xX
Posts: 26
Joined: Wed Aug 29, 2012 6:48 am
Location: Switzerland

Re: check_snmp always returns OK

Post 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
V3xX
Posts: 26
Joined: Wed Aug 29, 2012 6:48 am
Location: Switzerland

Re: check_snmp always returns OK

Post by V3xX »

replace check_snmp with a newer version solved the problem

thanks everyone for your help!

kind regards
V3xX
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: check_snmp always returns OK

Post by jsmurphy »

Glad you got it sorted out.
Locked