Can anybody see the problem with my event handler? Its purpose is simply to email the IT dept when our LVS cluster fails from one to the other. The event handler works fine and is activated at the correct time but it is not reading the $CONTACTEMAIL$ macro passed to it. The command def is:
command_line /usr/local/nagios/libexec/eventhandlers/LVS.sh $SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$ $CONTACTEMAIL$
And the event hadler script is:
**# What state is the LVS service in?
case “$1” in
# The service just came back up, so don’t do anything…
# We don’t really care about warning states, since the service is probably still running…
# We don’t know what might be causing an unknown error, so don’t do anything…
# Is this a "soft" or a "hard" state?
case "$2" in
/usr/bin/printf "=======>>> *****WARNING***** <=======\n\nActive LVS server may have changed, please check..." | /bin/mail -s "************* LVS FAILOVER *************" "$4"
The event handler reads all of the arguments passed except the “$4” which is the CONTACTEMAIL. I can see the eventhabdler activating in the log file and if I pass the email addresses manualy in the script or on the command line as nagios it works.
Can anybody help?