Problem with -r option in 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
semalan
Posts: 1
Joined: Wed Mar 16, 2011 3:02 am

Problem with -r option in check_snmp

Post by semalan »

Hi to all!

I have the following problem.
I need to check BGP service by check_snmp (I know about check_bgpstate, it doesn't meet my demands).
So, if request "check_snmp -H <some IP> -o 1.3.6.1.2.1.15.3.1.5.<some IP> -C <host's community>" returns 'OK - = IP address: 0.0.0.0' then service is down.
Therefore i can't use syntax like "check_snmp -H <some IP> -o 1.3.6.1.2.1.15.3.1.5.<some IP> -C <host's community> -s <expected string>" because if s="0.0.0.0" then it's not OK!
I tried to use something like "check_snmp -H <some IP> -o 1.3.6.1.2.1.15.3.1.5.<some IP> -C <host's community> -r '(?!0\.0\.0\.0)' " but get regexp compilation error :(

So, the question is: how to make check_snmp return OK if response NOT EQUAL 0.0.0.0 ? Maybe I need some sophisticated regexp?

Thanx
Lahn
Posts: 2
Joined: Tue Mar 15, 2011 7:34 pm

Re: Problem with -r option in check_snmp

Post by Lahn »

First of all, there's a simple parameter you can give check_snmp so it returns critical if regex matches: --invert-search
I'm not too good with regular expressions so can't tell you why you get a compilation error.

Furthermore, if you use the newest version of the nagios plugins (1.3.15), be aware that the return value is bugged and always return OK
http://sourceforge.net/tracker/index.ph ... tid=397597
Locked