Using NRPE for windows server
Re: Using NRPE for windows server
Thank you that worked.. So now the we are still stuck with the services not restarting
-
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Using NRPE for windows server
@skypete, Please let me know the output of the following command:
In Nagios Web interface please click on the service check to open up a Service State Information page. In the left column click on "Submit passive check result for this service", choose Critical, put anything in the Check Output, and click on Submit.
After that please download the nagios.log file from the server and send it to us:
Also, If you could attach the eventhandler one more time /usr/local/nagios/libexec/restart_service.sh just so I could double check that you deleted those two echo statements, that would be great.
Code: Select all
ls -l /usr/local/nagios/libexec/restart_service.sh
After that please download the nagios.log file from the server and send it to us:
Code: Select all
/usr/local/nagios/var/nagios.log
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Using NRPE for windows server
Here you go hope this helps.
- Attachments
-
- nagios.log
- (18.5 KiB) Downloaded 542 times
-
- Output.txt
- (390 Bytes) Downloaded 576 times
-
- restart_service.sh
- (159 Bytes) Downloaded 587 times
Re: Using NRPE for windows server
On the Windows servers, create a batch file called
In this folder
In that .bat file put the following
Save the file.
In your service file, you have the _SERVICE macro defined like this
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
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.
If they fail, post the full output of the commands.
Code: Select all
restart_service.bat
Code: Select all
C:\Program Files\NSClient++\scripts
Code: Select all
@echo off
net stop %1
net start %1
@exit 0
In your service file, you have the _SERVICE macro defined like this
Code: Select all
_SERVICE "spoolsv.exe"
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
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
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Using NRPE for windows server
Hello I have corrected the macro spooler.exe to spooler.
When I ran the command /usr/local/nagios/libexec/restart_service.sh CRITICAL 192.168.1.17 spooler
I get Print spooler service is starting,
The Print spooler service was started successfully.
Now is there a way when the service stops it will automatically start on its own without me running /usr/local/nagios/libexec/restart_service.sh CRITICAL 192.168.1.17 spooler ?
When I ran the command /usr/local/nagios/libexec/restart_service.sh CRITICAL 192.168.1.17 spooler
I get Print spooler service is starting,
The Print spooler service was started successfully.
Now is there a way when the service stops it will automatically start on its own without me running /usr/local/nagios/libexec/restart_service.sh CRITICAL 192.168.1.17 spooler ?
Re: Using NRPE for windows server
Good to hear that the tests worked. Now you know the scripts to stop and start the service works for you.
From the recent changes that I suggested, the check and the automatic starting of the service should work for you now.
Test it and see if it functions.
From the recent changes that I suggested, the check and the automatic starting of the service should work for you now.
Test it and see if it functions.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Using NRPE for windows server
It does not automatically restart the service when it is stopped.
Re: Using NRPE for windows server
Did you see the Nagios server detect that the service was not running and did you see that the Event Handler run trying to restart the service in the nagios.log file?
Be sure to check out our Knowledgebase for helpful articles and solutions!
Re: Using NRPE for windows server
Seems like its trying restart. here is the logs
- Attachments
-
- nagios.log
- (19.61 KiB) Downloaded 557 times
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Using NRPE for windows server
I believe you are correct I see this
Please show your command config for restart-service
This is the last piece of the puzzle to get correct
Code: Select all
[1520003818] SERVICE EVENT HANDLER: TESTSERVER1;Print Spooler;CRITICAL;HARD;1;restart-service
This is the last piece of the puzzle to get correct