Using NRPE for windows server

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Using NRPE for windows server

Post 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.
skypete
Posts: 98
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Post 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.
skypete
Posts: 98
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Post 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.
kyang

Re: Using NRPE for windows server

Post 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.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Post 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"?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
skypete
Posts: 98
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Post 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
}
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
skypete
Posts: 98
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Post 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"?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
skypete
Posts: 98
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Post by skypete »

Here you Go hope this helps.
Attachments
Capture1.PNG
Locked