Page 1 of 1

Change result of SNMP check from OK to critical

Posted: Wed Sep 04, 2019 1:50 pm
by snapon_admin
We're trying to setup an SNMP check to check if a specifig BGP neighbor is up or not, so we're using check_snmp against the OID of the specified IP, but when the OID is not found (meaning that the neighbor is down) the result is 'SNMP OK - No Such Instance currently exists at this OID'. We'd like to change that OK to a CRITICAL so we know that the neighbor is down and get an alert on it. Any thoughts on how to acomplish that?

Re: Change result of SNMP check from OK to critical

Posted: Wed Sep 04, 2019 3:28 pm
by mbellerue
Can you give us a screenshot of the check command and the arguments being passed to it?

Re: Change result of SNMP check from OK to critical

Posted: Wed Sep 04, 2019 3:38 pm
by snapon_admin
Screenshot attached. Note: the below screenshot is with the BGP neighbor up which SHOULD result in an ok status. The status changes to say 'No Such Instance currently exists at this OID' when the neighbor is down, but remains with the preface 'SNMP OK -'

command: /usr/local/nagios/libexec/check_snmp -H <IP_ADDRESS> -p 161 -o bgpPeerRemoteAddr.<PEER IP REDACTED> -C <COMMUNITY> -P 2c -m BGP4-MIB

Re: Change result of SNMP check from OK to critical

Posted: Thu Sep 05, 2019 10:56 am
by mbellerue
If you added

Code: Select all

--string="IpAddress: <rest of return SNMP message here>"
check_snmp should return critical when that string is not returned.

Otherwise the next best thing would be to write a wrapper script that looks specifically for the "No such instance" string, and returns critical.