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

Re: Using NRPE for windows server

Post by skypete »

Here you go also wanted to let you know it did not go into a critical state in nagios UI.
Last edited by skypete on Thu Feb 22, 2018 2:22 pm, edited 1 time in total.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Post by npolovenko »

@skypete, If the service on the windows server has been stopped and you waited 20 minutes but Nagios still shows that the process is running, then either your Nagios config is pointing to a wrong server or the process is still actually running. These are two scenarios I can think of.
So, on the windows server please open the command line and run:

Code: Select all

ipconfig
And take a screenshot.

Then, run:
net stop spooler

Then open the services menu and take a screenshot of the PrintSpooler process so that we can make sure that it stopped.
Untitled.png
Then wait 10 minutes and check the Nagios web interface to see if the service check is red.


Also, run these commands:

Code: Select all

service nagios status
service httpd status

Code: Select all

service nagios restart
service httpd restart
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 »

ahh ok so when I ran service httpd restart i get a failed to restart httpd.service:unit httpd.service not found. When i try to start httpd service, i get this error Failed to start httpd.service: Unit httpd.service not found. Is there something else that needs to be installed in the nagios core server using Ubuntu 16.04 was there something i missed? and is this a crucial part of getting the service to automatically restart?

I followed this article by the way and thank you.

https://support.nagios.com/kb/article/n ... tml#Ubuntu
bolson

Re: Using NRPE for windows server

Post by bolson »

On Ubuntu and Debian that command should be:

Code: Select all

sudo systemctl restart apache2.service
skypete
Posts: 98
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Post by skypete »

Hi for sure it pointing to the correct server. i ran all the commands and still same issue. The service is completely stopped.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Post by npolovenko »

@skypete, Please stop the service one more time, then open the task manager in windows and make sure that there are no duplicate spooler processes running. After you made sure that the process is stopped go to the Nagios Core Web Interface, find the service check and click on Re-schedule the next check of this service. Wait a couple minutes and take a screenshot of the service state information page.
Also, you did not upload two screenshots that I asked for in the previous post.
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 »

I waited 30 min and restart the service from the nagios UI same result. Here are the screenshots you asked for thanks for your help.
Attachments
Services Stopped.PNG
Service Status.PNG
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Post by npolovenko »

@skypete, I think I finally understand what's going on! :D Please open the /usr/local/nagios/etc/commands.cfg file and replace your current check_nrpe command definition with the following one:

Code: Select all

# 'check_nrpe' command definition
define command {
       command_name     check_nrpe
       command_line     $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ -a $ARG2$ $ARG3$
    }
You can also remove all testing lines from the event handler, including:

Code: Select all

echo "/usr/local/nagios/libexec/check_nrpe -H \"$2\" -p 5666 -c restart_service -a \"$3\"" > testing.txt
and 
echo "Event handler works!" > testing.txt
Restart nagios with:

Code: Select all

service nagios restart
Stop the spooler process and force check the process in Nagios GUI.
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 the good news the spooler finally showed up as critical but no restart as of yet. All the other services are not working such as cpu load etc the are showing up as unknown here is a screen shot.
Attachments
Unkown errors.PNG
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Post by npolovenko »

Hello, @skypete. Please change the nrpe command back to:

Code: Select all

define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -t 30 -c $ARG1$ $ARG2$ 
}
And change the service command to:

Code: Select all

define service {
       host_name                 TESTSERVER1,TESTSERVER2
       service_description       Print Spooler
       check_command           check_nrpe!check_process!-a process=spoolsv.exe show-all
       max_check_attempts        1
       event_handler             restart-service
       check_interval            3
       retry_interval            1
       check_period              24x7
       notification_interval     60
       notification_period       24x7
       contacts                  nagiosadmin
       _SERVICE                 "spoolsv.exe"
    }
Then restart nagios:

Code: Select all

service nagios restart
That should fix all the other service checks and get the spooler one to work as well.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked