On the Windows servers, create a batch file called
- Code: Select all
restart_service.bat
In this folder
- Code: Select all
C:\Program Files\NSClient++\scripts
In that .bat file put the following
- Code: Select all
@echo off
net stop %1
net start %1
@exit 0
Save the file.
In your service file, you have the _SERVICE macro defined like this
- Code: Select all
_SERVICE "spoolsv.exe"
The windows net command doesn't stop and start the service by it's exe name. It does it by the service name,
So login to the Windows system and open up the service application and then look at the Service name for the print spooler.
On my Windows 7 system, it is called Spooler so mu service macro looks like this
- Code: Select all
_SERVICE spooler
Edit your service check and update your macro's name.
To test the name, run the following commands to see if they will restart the spooler service on your 2 servers.
- Code: Select all
/usr/local/nagios/libexec/servicerestart.sh CRITICAL 192.168.1.17 spooler
/usr/local/nagios/libexec/servicerestart.sh CRITICAL 192.168.1.18 spooler
If they fail, post the full output of the commands.