Monitor A Service On Windows/Linux & Restart If Down

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
pavankumar
Posts: 14
Joined: Wed Aug 28, 2019 11:03 am

Monitor A Service On Windows/Linux & Restart If Down

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Monitor A Service On Windows/Linux & Restart If Down

Post by lmiltchev »

I believe you could achieve this by following the steps, outlined in our official documentation:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf

https://assets.nagios.com/downloads/nag ... h-NRPE.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
pavankumar
Posts: 14
Joined: Wed Aug 28, 2019 11:03 am

Re: Monitor A Service On Windows/Linux & Restart If Down

Post by pavankumar »

We are using NCPA.

Thanks
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Monitor A Service On Windows/Linux & Restart If Down

Post 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
Locked