Page 5 of 10

Re: Using NRPE for windows server

Posted: Thu Feb 08, 2018 5:04 pm
by dwhitfield
Can you provide the service config for the DHCP service? Monitoring the service is how you would know it is back.

That said, I would suggest opening different threads for each service where you are having issues. We are going to have to look at service configs and the services on the Windows side and it's going to be very confusing to try to do all of that in one thread.

Re: Using NRPE for windows server

Posted: Thu Feb 08, 2018 5:10 pm
by skypete
Could you direct me on a simple service restart that you know would work something common and explain step by step sorry for the trouble. I am trying this of service as a test for now just to see the results

service_description DHCP Client
check_command check_nrpe!check_process!process=Dhcp!show-all

dwhitfield wrote:Can you provide the service config for the DHCP service? Monitoring the service is how you would know it is back.

That said, I would suggest opening different threads for each service where you are having issues. We are going to have to look at service configs and the services on the Windows side and it's going to be very confusing to try to do all of that in one thread.

Re: Using NRPE for windows server

Posted: Thu Feb 08, 2018 5:12 pm
by skypete
Another thing i forgot to mention is that i would stop the service and it would still show up in nagios that it is ok.

skypete wrote:Could you direct me on a simple service restart that you know would work something common and explain step by step sorry for the trouble. I am trying this of service as a test for now just to see the results

service_description DHCP Client
check_command check_nrpe!check_process!process=Dhcp!show-all

dwhitfield wrote:Can you provide the service config for the DHCP service? Monitoring the service is how you would know it is back.

That said, I would suggest opening different threads for each service where you are having issues. We are going to have to look at service configs and the services on the Windows side and it's going to be very confusing to try to do all of that in one thread.

Re: Using NRPE for windows server

Posted: Thu Feb 08, 2018 5:36 pm
by kyang
Could you direct me on a simple service restart that you know would work something common and explain step by step sorry for the trouble
Let me know if you run into any troubles.

1. To test simply stop the Print Spooler service on the Windows machine.

2. Open the Services console under "Administrative Tools."

3. Right-click the Print Spooler service and select "Stop."
Capture.PNG
4. Wait for the service to go to a "critical state" or "force the next check" in the Nagios Core interface.

5. Once the Nagios Core Print Spooler service is in a "critical state" the event handler will be executed and the Windows Print Spooler service will be restarted.
The next time Nagios Core checks the Print Spooler service.

It should to an OK state as the Windows Print Spooler service will now be running.
Or look back in Windows and check if the Printer Spooler service is turned back on by right-clicking it.

6. If the event handler does not appear to be working as expected, check the /usr/local/nagios/var/nagios.log file for any errors.

Re: Using NRPE for windows server

Posted: Fri Feb 09, 2018 10:45 am
by npolovenko
Can you test this command from the Nagios server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H windows_server_ip_address -p 5666 -c restart_service -a service_name
Replace the windows server IP with the actual IP, and service_name with the windows service that you want to restart. Does it successfully restart the service for you or do you get "unknown command"?

Re: Using NRPE for windows server

Posted: Fri Feb 09, 2018 1:28 pm
by skypete
Hi i readded this command and rename it as the following in my cfg file it is not working nagios wont restart the service.

define service {
host_name HostName
service_description Print Spooler
check_command check_nrpe!check_process!process=spoolsv.exe!show-all
max_check_attempts 5
event_handler restart-service
check_interval 5
retry_interval 1
check_period 24x7
notification_interval 60
notification_period 24x7
contacts nagiosadmin
}

Re: Using NRPE for windows server

Posted: Fri Feb 09, 2018 2:40 pm
by npolovenko
Hi i readded this command and rename it as the following in my cfg file it is not working nagios wont restart the service.
Please run this command and share the output in your next post:

Code: Select all

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Please run this command locally, from the command line and let me know if it suceeds:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H windows_server_ip_address -p 5666 -c restart_service -a service_name

Re: Using NRPE for windows server

Posted: Fri Feb 09, 2018 4:08 pm
by skypete
When i stop the services from windows it does not automatically restart. but when i ran that command it works.Still having trouble with auto restart. can we try another service command?

npolovenko wrote:Can you test this command from the Nagios server:

Code: Select all

/usr/local/nagios/libexec/check_nrpe -H windows_server_ip_address -p 5666 -c restart_service -a service_name
Replace the windows server IP with the actual IP, and service_name with the windows service that you want to restart. Does it successfully restart the service for you or do you get "unknown command"?

Re: Using NRPE for windows server

Posted: Mon Feb 12, 2018 12:13 pm
by npolovenko
@skypete, Well, we need to figure out what's wrong with the old service command. Please run these two commands:

Code: Select all

service nagios restart

/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
And show me the output of both commands please, without this information I will not be able to figure out what's going on.

Re: Using NRPE for windows server

Posted: Mon Feb 12, 2018 1:47 pm
by skypete
Here you Go hope this helps.