Nagios plugin wont send email alerts


#1

All, i have written a wrapper for a plugin that has issues running through nagios and sending out email alerts with a threshold is exceeded. The wrapper works fine commandline, will show as warning or critical on the nagios url, but no email alerts are sent. The definitions for the service check are set properly. But i cant figure this out. Here is the wrapper below. And before anyone asks, the original plugin needs to be run through a wrapper because of ePN issues.

#!/bin/sh
res=$(/usr/local/nagios/libexec/check_mysql -w=6 -c=800)

#result= $result | awk '{print $1}'
echo $res

STATE_OK=0
STATE_CRITICAL=2
STATE_WARNING=1

case “$res” in
OK) exit $STATE_OK ;;
WARNING) exit $STATE_WARNING ;;
CRITICAL) exit $STATE_CRITICAL ;;
*) exit 3 ;;
esac


#2

Plugin doesn’t have anything with the notification system of Nagios. When plugins are executed, they only send it’s output and an exit code to Nagios, nothing more. Nagios is the one that sends notifications when the right condition is met dependently on your configuration.
I’m pretty sure there is something wrong in your configuration of Nagios.
Check that you have enabled notifications in nagios.cfg, check the notification options for that service and check the contact and contactgroup definitions. Maybe you could post them all here so we could figure out what went wrong.