Using snmp to check mailq on remote host

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
wisp
Posts: 1
Joined: Tue Nov 27, 2012 9:33 am

Using snmp to check mailq on remote host

Post by wisp »

I have been able to check remote hosts using the snmp command to run the check_mailq command remotely. Unfortunately I can't get nagios to alarm based on the results. The check_mailq returns the proper alarm whether it be warn or critical but when the snmp returns this result you end up with SNMP - OK :Critical: mailq is 3 ..." and the service will always be green. I have been unable to find out how to get around this. It seems the snmp check always puts that OK at the beginning which causes nagios to think everything is good. I am using nagios 3.4.1
User avatar
jsmurphy
Posts: 989
Joined: Wed Aug 18, 2010 9:46 pm

Re: Using snmp to check mailq on remote host

Post by jsmurphy »

Ahhh a classic trap, you're making the assumption that the words "OK" or "Critical" in the description mean anything to the Nagios engine. They do not. Nagios is all about the exit codes.

check_snmp hasn't been told how to tell the difference between OK and Critical, so it is just assuming that everything is always good. The easiest way to fix your problem would be to change your check_snmp to use the -r directive to tell it how to detect something going bad:

Code: Select all

./check_snmp [i]normal stuff here[/i] -r "OK"
Locked