Good Day,
I am unable to get a simple service restart event handler working, the components all function separately (I.e., I can call the restart.bat from nrpe as well as execute the "libexec/restart_service.sh CRITICAL HOST spooler" command), however the service check appears to not execute it on failure. I've spent hours looking through the support forum and reviewing the documentation but nothing seems to work.
restart_service.sh perms:
ls -la libexec/restart_service.sh
-rwxr-xr-x. 1 apache nagios 158 Feb 18 10:01 libexec/restart_service.sh
restart_service.sh:
#!/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
restart_service.bat:
@echo off
net stop %1
net start %1
@exit 0
Relevant nsclient.ini settings:
[/modules]
CheckExternalScripts = enabled
CheckHelpers = enabled
[/settings/NRPE/server]
allow arguments = true
[/settings/external scripts]
allow arguments = true
[/settings/external scripts/scripts]
restart_service=scripts\restart_service.bat "$ARG1$" (I have tried not wrapping $ARG1$ in quotes and get the same results)
Thank you
Windows Service Event Handler Not Working
Windows Service Event Handler Not Working
You do not have the required permissions to view the files attached to this post.
Re: Windows Service Event Handler Not Working
Hi jimmlegs,
I think the issue that you are passing the "-H" to the "restart_service.sh", which is the argument "$1" and that does not match your "case" condition (please see picture).
Remove the "-H" and your event handler should runs through the "case" statement.
Regards,
Vinh
I think the issue that you are passing the "-H" to the "restart_service.sh", which is the argument "$1" and that does not match your "case" condition (please see picture).
Remove the "-H" and your event handler should runs through the "case" statement.
Regards,
Vinh
You do not have the required permissions to view the files attached to this post.
Re: Windows Service Event Handler Not Working
That was it! Thank you very much, I was pulling my hair out.
Please close/lock this case
Please close/lock this case
Re: Windows Service Event Handler Not Working
Great!! .... ticket closed/locked!!