Page 8 of 10

Re: Using NRPE for windows server

Posted: Wed Feb 21, 2018 5:49 pm
by skypete
Here you go also wanted to let you know it did not go into a critical state in nagios UI.

Re: Using NRPE for windows server

Posted: Thu Feb 22, 2018 1:36 pm
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

Re: Using NRPE for windows server

Posted: Thu Feb 22, 2018 2:21 pm
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

Re: Using NRPE for windows server

Posted: Thu Feb 22, 2018 3:55 pm
by bolson
On Ubuntu and Debian that command should be:

Code: Select all

sudo systemctl restart apache2.service

Re: Using NRPE for windows server

Posted: Fri Feb 23, 2018 9:08 am
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.

Re: Using NRPE for windows server

Posted: Fri Feb 23, 2018 1:56 pm
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.

Re: Using NRPE for windows server

Posted: Fri Feb 23, 2018 3:03 pm
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.

Re: Using NRPE for windows server

Posted: Fri Feb 23, 2018 3:59 pm
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.

Re: Using NRPE for windows server

Posted: Fri Feb 23, 2018 4:57 pm
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.

Re: Using NRPE for windows server

Posted: Mon Feb 26, 2018 2:12 pm
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.