Using NRPE for windows server

An open discussion forum for obtaining help with Nagios Core. Nagios Core users of all experience levels are welcome here. Subforum have been created for the discussion of Nagios Core and Nagios Plugin development.

NOTE: The SourceForge.net mailing lists have been deprecated in favor of this forum in order to expedite support and provide additional features not available on the old mailing list.

Re: Using NRPE for windows server

Postby skypete » Thu Feb 15, 2018 4:29 pm

npolovenko wrote:
It will only work when i ran the /usr/local/nagios/libexec/check_nrpe -H (IP Adress of server) -c restart_service -a spooler than it will go back to its current state.

You're saying that running this command manually changes what you see in the UI? That is impossible.
when I run chown apache:nagios /usr/local/nagios/libexec/restart_service.sh i get this error chown: invlaid user: apache:nagios

You can try chown apache.nagios /usr/local/nagios/libexec/restart_service.sh



No sorry I meant when i run that command it automatically restarts the service.
And when i chown apache.nagios /usr/local/nagios/libexec/restart_service.sh same error
skypete
 
Posts: 90
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Postby npolovenko » Thu Feb 15, 2018 4:40 pm

@skypete, Well it says it's running.

root@ubuntu:/usr/local/nagios/libexec# ./check_nrpe -H IP ADDRESS -c check_process -a process=spoolsv.exe show-all
OK: spoolsv.exe=started|'spoolsv.exe state'=1;0;0 'count'=1;0;0


But that's only one of two commands that I asked you to run. Did you also stop the service on windows and then checked with nrpe one more time? Please show the nrpe check when the service is down.

Please make the service go into the critical state again and then upload the testing.txt file so that we can see what's going on.

Please upload the file.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 2352
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Postby skypete » Thu Feb 15, 2018 4:46 pm

The Service does not go into any critical state like i mentioned before it only stays at green even though i would stop the service on the window server.

here are the results of the command.

root@ubuntu:/usr/local/nagios/libexec# ./check_nrpe -H IP ADDRESS -c check_process -a process=spoolsv.exe show-all
CRITICAL: critical(spoolsv.exe=stopped)|'spoolsv.exe state'=0;0;0 'count'=1;0;0
Attachments
testing.txt
(21 Bytes) Downloaded 118 times
skypete
 
Posts: 90
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Postby npolovenko » Thu Feb 15, 2018 6:02 pm

@skypete, I modified the event handler script earlier. This is the most recent version that I was referring to. I need the testing.txt output from this event handler.

Code: Select all
#!/bin/sh
case "$1" in
OK)
;;
WARNING)
;;
UNKNOWN)
;;
CRITICAL)
/usr/local/nagios/libexec/check_nrpe -H "$2" -p 5666 -c restart_service -a "$3"
echo "/usr/local/nagios/libexec/check_nrpe -H \"$2\" -p 5666 -c restart_service -a \"$3\"" > testing.txt

;;
esac


Also, If the service checks never went red how did the event handler run?

The Service does not go into any critical state like i mentioned before it only stays at green even though i would stop the service on the window server.

Did you wait 5 minutes after you turned off the windows service before checking in the GUI? Click on the print spooler service in nagios core web interface, then click on Re-schedule the next check of this service.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 2352
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Postby skypete » Fri Feb 16, 2018 10:43 am

Did you wait 5 minutes for it to turn red?
I have multiple times waited and restarted and no luck.

Also the testing file is not showing up,the only way for it to show up in the libexec folder is to run this command which created the file.

echo "Event handler works!" > testing.txt

Could you explain step by step to get install maybe i missed something sorry. note I do have this as a bat script also will the testing.txt file when it is created would it be in the libexec folder?

@echo off
net stop %1
net start %1
@exit 0

And it is save in this directory
C:\Program Files\NSClient++\scripts\
skypete
 
Posts: 90
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Postby npolovenko » Fri Feb 16, 2018 2:25 pm

@skypete, Since you can restart a windows service remotely with that NRPE command I wouldn't worry about that.
And when you run this:
root@ubuntu:/usr/local/nagios/libexec# ./check_nrpe -H IP ADDRESS -c check_process -a process=spoolsv.exe show-all
CRITICAL: critical(spoolsv.exe=stopped)|'spoolsv.exe state'=0;0;0 'count'=1;0;0

You get the correct output. But in the Core Web interface, it's still green, which makes me believe that your host definition is incorrect. When we created a service:
Code: Select all
define service {
host_name HostName
service_description Print Spooler

What did you put instead of HostName?
Did you define the host for windows service?
Code: Select all
define host {
    host_name              HostName
    address                 192.168.1.10
    max_check_attempts      5
    check_interval          5
    retry_interval          1
    check_period            24x7
    contacts                nagiosadmin
    notification_interval   60
    notification_period     24x7
    notifications_enabled   1
}

And then the hostname in define_service has to match the hostname in define_host. IP address in host definition has to be the real windows server IP. Can you double check on that, please?

In both service definition and host definition please temporarely change:
Code: Select all
max_check_attempts to 1
check_interval to 3
retry_interval to 1
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 2352
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Postby skypete » Fri Feb 16, 2018 2:50 pm

Hi thanks I do have two windows servers i am testing on just to see the if both have any issues running the service defentions. I did put the the correct hostname of the servers in the define host line and the ip address so i double checked it and they are both correct.


I did temporarely change

Code: Select all
max_check_attempts to 1
check_interval to 3
retry_interval to 1

still same issue sorry :) i did upload my clientini file maybe there is some setting that is not enabled?
Attachments
Test Ini.txt
(8.87 KiB) Downloaded 126 times
skypete
 
Posts: 90
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Postby npolovenko » Fri Feb 16, 2018 5:59 pm

@skypete, Can you download and zip the whole /usr/local/nagios/etc/ folder on the Nagios Server using Filezilla or WinSCP and upload it here?
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 2352
Joined: Mon May 15, 2017 5:00 pm

Re: Using NRPE for windows server

Postby skypete » Tue Feb 20, 2018 9:25 am

Here you go.
Attachments
ETC Folder.zip
(35.21 KiB) Downloaded 25 times
skypete
 
Posts: 90
Joined: Sat Dec 02, 2017 11:44 pm

Re: Using NRPE for windows server

Postby npolovenko » Wed Feb 21, 2018 1:37 pm

@skypete. The config looks fine. Can you stop these 2 windows services again, then wait 20 minutes, refresh Nagios core web interface and check if the status of the service checks changed to red. If not please upload the /usr/local/nagios/var/nagios.log file, and also nsclient.log file from the windows server. Also nsclient.ini file, please.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
npolovenko
Support Tech
 
Posts: 2352
Joined: Mon May 15, 2017 5:00 pm

PreviousNext

Return to Nagios Core

Who is online

Users browsing this forum: No registered users and 16 guests