Event handler – win service restart
Posted: Mon Jan 02, 2017 5:20 am
Hello i have a little problem with understandig this handler:
This is OK
But this is not
Commands.cfg
Windows.cfg
Restart_service.sh
restart_service.bat
When i using /usr/local/nagios/libexec/restart_service.sh CRITICAL 172.17.54.10 autoRest.exe
I´ve got test file in nagios/log
It must be something easy, but i can´t find it.
Thanks for the reply
This is OK
Code: Select all
/usr/local/nagios/libexec/restart_service.sh CRITICAL 172.17.54.10 autoRest.exeCommands.cfg
Code: Select all
define command{
command_name resetujSluzbu
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -p 5666 -c restart_service -a GSSAUT01.exe
}Code: Select all
define service{
use generic-service
host_name winserver
service_description sollIT
check_command check_nt!SERVICESTATE!-d SHOWALL -l GSSAUT01.exe
event_handler resetujSluzbu
}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 0Code: Select all
@echo off
net stop %1
net start %1
echo.>"C:\nagios\log\test.txt"
@exit 0I´ve got test file in nagios/log
It must be something easy, but i can´t find it.
Thanks for the reply