eventhandler
Posted: Fri Sep 07, 2018 8:32 am
Hy,
i am attemting to create an event handler for my windows services but cant get it working.
what i have done is :
installed ns client on the windows side configured the base install (ip port etc).
created a script called restart_service.bat
i created a script alias restart_service= scripts\restart_service.bat $ARG1$ and a script command restart_service = scripts\restart_service.bat $ARG1$
on the linux side i created a script and placed it in the libex folder :
and then i created a new command in commands.cfg
then i adjusted my server.cfg, but when is stop my service on the windows machine it does not restart how can i fix this ?
i am attemting to create an event handler for my windows services but cant get it working.
what i have done is :
installed ns client on the windows side configured the base install (ip port etc).
created a script called restart_service.bat
Code: Select all
@echo off
net stop %1
net start %1
@exit 0
on the linux side i created a script and placed it in the libex folder :
Code: Select all
#!/bin/sh
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
/usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c restart_service -a "$3"
;;
esac
exit 0
Code: Select all
#restart sevice
define command{
command_name restart_service
command_line $USER1$/restart_service $SERVICESTATE$ $HOSTADDRESS$
}