Event Handler stopped working!
Posted: Wed Jun 13, 2018 8:47 am
Hi all,
I had an event handler which worked fine until a couple of days ago and I can't understand why.
If anyone can help me I would be grateful.
This is the error:
it is as if it can't get the values of the macros passed via event-handlers-commands.cfg
This is my event handler script:
Could anyone please point me to the right direction?
Thank you
I had an event handler which worked fine until a couple of days ago and I can't understand why.
If anyone can help me I would be grateful.
This is the error:
Code: Select all
[1528896858] SERVICE ALERT: stag-hr-gal-gw-01;LService;CRITICAL;HARD;1;LService is stopped and can be resumed, trying to restart it
[1528896858] SERVICE EVENT HANDLER: stag-hr-gal-gw-01;LService;CRITICAL;HARD;1;resume-hr-LService
[1528896858] wproc: SERVICE EVENTHANDLER job 274 from worker Core Worker 727 is a non-check helper but exited with return code 2
[1528896858] wproc: early_timeout=0; exited_ok=1; wait_status=512; error_code=0;
[1528896858] wproc: stderr line 01: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: 14: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: $=CRITICAL: not found
[1528896858] wproc: stderr line 02: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: 15: /usr/local/nagios/libexec/eventhandlers/resume-hr-:LService: $=HARD: not found
[1528896858] wproc: stderr line 03: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: 16: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: $=1: not found
[1528896858] wproc: stderr line 04: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: 17: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: $=10.101.22.76: not found
[1528896858] wproc: stderr line 05: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: 18: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: $=$: not found
[1528896858] wproc: stderr line 06: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: 53: /usr/local/nagios/libexec/eventhandlers/resume-hr-LService: Syntax error: end of file unexpected (expecting ";;")
Code: Select all
define command{
command_name resume-hr-LService
command_line /usr/local/nagios/libexec/eventhandlers/resume-hr-LService $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$ $HOSTADDRESS$ $ISVALIDETIME$
}
Code: Select all
#!/bin/sh
$SERVICESTATE$=$1
$SERVICESTATETYPE$=$2
$SERVICEATTEMPT$=$3
$HOSTADDRESS$=$4
$ISVALIDETIME$=$5
# What state is the service in?
case "$1" in
OK)
# The service just came back up, so don't do anything...
;;
WARNING)
# Warning don't do anything...
;;
CRITICAL)
# Is this a "soft" or a "hard" state?
case "$2" in
HARD)
case "$3" in
1)
if [ $5:hr-s3bt-nm$ = 1 ] ; then
# Trying to resume LService.
/usr/local/nagios/libexec/check_by_ssh -t 45 -H $4 -l nagios -C "sudo /usr/local/bin/start_ls.sh"
fi
;;
esac
;;
UNKNOWN)
# We don't know what might be causing an unknown error, so don't do anything...
;;
esac
exit 0
Thank you