Page 1 of 1

How do I set status based on check?

Posted: Wed Mar 28, 2012 7:36 pm
by bmcwhirt
I am having trouble understanding exactly how I go about setting the status based on a check_snmp. Here is my service definitions

Code: Select all

define service{
	use generic-service
	host_name cisco1760
	service_description FastEthernet0/0 Status
	check_command check_snmp!-C public -o ifOperStatus.2
}
What gets displayed in status information:
SNMP OK - 1 (this is if the interface is up)
SNMP OK - 2 (this is if the interface is down)

Ideally I would like to have this be yellow:warning if the interface has been down less than 5 minuets and red:critical if 5 minuets or longer, but even just setting it to one or the other is acceptable.

Thanks

Re: How do I set status based on check?

Posted: Thu Mar 29, 2012 4:53 pm
by jsmurphy
You need to use the -r modifier to tell it what the expected return should be. So your command should be:

check_command check_snmp!-C public -o ifOperStatus.2 -r 1

Re: How do I set status based on check?

Posted: Thu Mar 29, 2012 5:31 pm
by bmcwhirt
Ok, I made those changes and restarted nagios and waited for an updated check to occur but the status remains 'OK' even when the return value is not 1

Re: How do I set status based on check?

Posted: Sun Apr 01, 2012 6:17 pm
by jsmurphy
Are you able to try this from the Linux command line? Are you able to post the exact command you execute and what it returns?

/usr/lib/nagios/libexec/check_snmp -H hostname -v 2c -C public -o ifOperStatus.2 -r 1 (should be the full command but I am operating from memory here so it might not be exact)