Page 1 of 1
Monitor A Service On Windows/Linux & Restart If Down
Posted: Thu Apr 30, 2020 12:21 pm
by pavankumar
Hi,
We need to check the status of a service on Windows/Linux and restart it based on corresponding startup script.
Is there a out of box solution in NagiosXI for this requirement?
Thanks,
Pavan.
Re: Monitor A Service On Windows/Linux & Restart If Down
Posted: Thu Apr 30, 2020 4:54 pm
by lmiltchev
Re: Monitor A Service On Windows/Linux & Restart If Down
Posted: Tue May 05, 2020 11:34 am
by pavankumar
We are using NCPA.
Thanks
Re: Monitor A Service On Windows/Linux & Restart If Down
Posted: Tue May 05, 2020 4:19 pm
by ssax
The setup is still the same for the XI side.
The only differences on the NCPA side would be for you to put the plugin in the NCPA plugins directory on the server and the restart scripts would be:
- Note: Make sure to change the
<your token> part
Code: Select all
#!/bin/sh
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
/usr/local/nagios/libexec/check_ncpa.py -H "$2" -t '<your token>' -M 'plugins/restart_service.bat' -q "args=$3"
;;
esac
exit 0
You can test from your XI server with this:
Code: Select all
/usr/local/nagios/libexec/check_ncpa.py -H X.X.X.X -t '<your token>' -M 'plugins/restart_service.bat' -q "args=spooler"
See here:
Code: Select all
https://www.nagios.org/ncpa/help.php#api-modules-plugins