Page 2 of 5

Re: Windows Service Monitoring

Posted: Tue Nov 10, 2020 1:53 am
by HBRMonitoring
./check_ncpa.py -H 172.26.28.36 -t 'Admin@1234' -V
check_ncpa.py, Version 0.3.5


curl -k -L -v https://172.26.28.36:5693
* About to connect() to 172.26.28.36 port 5693 (#0)
* Trying 172.26.28.36... connected
* Connected to 172.26.28.36 (172.26.28.36) port 5693 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* NSS error -12190
* Closing connection #0
* SSL connect error
curl: (35) SSL connect error




/usr/local/nagios/libexec/check_ncpa.py -H 172.26.28.36 -t 'Admin@1234' -M services -q service=W32Time,status=running -v
Connecting to: https://172.26.28.36:5693/api/services/ ... ce=W32Time
File returned contained:
{
"returncode": 0,
"stdout": "OK: W32Time is running"
}
An error occurred:'value'

Re: Windows Service Monitoring

Posted: Tue Nov 10, 2020 6:25 pm
by benjaminsmith
HI,

While it is actaully returning the result we would expect, you're getting an SSL error.

Code: Select all

curl: (35) SSL connect error
What version of curl do you have installed on the server? They maybe out of date.

Code: Select all

rpm -qa | grep curl

Re: Windows Service Monitoring

Posted: Wed Nov 11, 2020 6:28 am
by HBRMonitoring
-bash-4.1$ ./check_ncpa.py -H 172.26.28.36 -t 'Admin@1234' -M services -q service=W32Time,status=running -v
Connecting to: https://172.26.28.36:5693/api/services/ ... ce=W32Time
File returned contained:
{
"returncode": 0,
"stdout": "OK: W32Time is running"
}
An error occurred:'value'


-bash-4.1$ rpm -qa | grep curl
libcurl-7.19.7-46.el6.x86_64
python-pycurl-7.19.0-8.el6.x86_64
curl-7.19.7-46.el6.x86_64

Re: Windows Service Monitoring

Posted: Thu Nov 12, 2020 11:36 am
by benjaminsmith
Hi @HBRMonitoring,

While there does seem to be an issue with curl negotiating over SSL, the check results are coming back as expected.

We recommend updating the check_ncpa plugin on the XI server as it's out of date. You can download the plugin from this link.

Code: Select all

wget https://assets.nagios.com/downloads/ncpa/check_ncpa.tar.gz
To set the proper permissions.

Code: Select all

chown apache:nagios /usr/local/nagios/libexec/check_ncpa.py
chmod 775 /usr/local/nagios/libexec/check_ncpa.py
Please try setting up the checks on the Nagios XI server and let me know if they are working successfully.

Re: Windows Service Monitoring

Posted: Mon Nov 16, 2020 5:14 am
by HBRMonitoring
Hi,

I should be running this on the Nagios server, isnt it?
I already see one there.

/usr/local/nagios/libexec/check_ncpa.py
-rwxr-xr-x. 1 nagios nagios 9332 Jan 19 2016 /usr/local/nagios/libexec/check_ncpa.py

1. Is it okay to upgrade?
2. Are there any impact on the existing NCPA monitoring?
3. How do I check where the NCPA monitoring is used (is there a way I can check if this command is used in any service and the service is deployed on any host) ? If they are not used, I can upgrade easily, else I need to take permission from business to do so.

Re: Windows Service Monitoring

Posted: Mon Nov 16, 2020 5:41 pm
by benjaminsmith
Hi,

Yes, you can upgrade the plugin and it should not impact any hosts running older versions of the NCPA agent. Since it's only a plugin, I would make a backup of the older version on the server, so you can copy that back over if needed.

There isn't a direct way to query all the services running a specific plugin in the CCM. However, the following API call will return a list of all the services and config settings ( host checks typically just use check_http or check_ping).

Code: Select all

curl -XGET "https://192.168.23.112/nagiosxi/api/v1/config/service?apikey=<your API key>&check_command=check_xi_ncpa&pretty=1
You can either search through the output or save the output to a file and import this into a spreadsheet and sort. It's possible to import json data using Excel.

Let me know if you need further assistance.
Benjamin

Re: Windows Service Monitoring

Posted: Tue Nov 17, 2020 10:56 am
by HBRMonitoring
Hi Benjamin,

Please find below details and screenshots

/usr/local/nagios/libexec/check_ncpa.py -H 172.26.28.36 -t '"<token>' -M services -q service=W32Time,status=running -v
Connecting to: https://172.26.28.36:5693/api/services/ ... us=running
File returned contained:
{
"returncode": 0,
"stdout": "OK: W32Time is running"
}
OK: W32Time is running



/usr/local/nagios/libexec/check_ncpa.py -H <IP> -t '<token>' -V
check_ncpa.py, Version 1.2.3


Kindly let me know if this is all good and if I can proceed to monitor the W32Time service on all the Windows box.

Re: Windows Service Monitoring

Posted: Tue Nov 17, 2020 12:01 pm
by benjaminsmith
Hi @HBRMonitoring,

Thanks for posting that screenshot. Looks like the check results are being processed successfully.

Benjamin

Re: Windows Service Monitoring

Posted: Wed Nov 18, 2020 7:08 am
by HBRMonitoring
Yes, but the issue is on a few Windows servers, I am not getting the output, instead getting error as below

COMMAND: /usr/local/nagios/libexec/check_ncpa.py -H <server FQDN> -t '<token>' -P 5693 -M 'services' -q 'service=w32time,status=running'
OUTPUT: UNKNOWN: Execution exceeded timeout threshold of 60s

Same error even if I use IP Address too instead of FQDN.

I also tried the service name as W32Time, still it is the same issue on these set of servers.
Few of these servers are Prod, few as Non-Prod. so, nothing in common among the servers
I also gave -T 120, still getting timeout error, but a little different

COMMAND: /usr/local/nagios/libexec/check_ncpa.py -H <Server FQDN> -t '<token>' -P 5693 -M 'services' -q 'service=W32Time,status=running' -T 120
OUTPUT: UNKNOWN: An error occured connecting to API. (Connection error: '[Errno 110] Connection timed out')

Same error even if I use IP Address too instead of FQDN.

Re: Windows Service Monitoring

Posted: Wed Nov 18, 2020 5:56 pm
by benjaminsmith
HI,

It looks like there's a firewall or other connection issue between XI and those Windows servers. Make the service is running on those hosts and then that the connection is not being blocked by a firewall.

Configuring the firewall for Windows is on page 13 of the following guide.

https://assets.nagios.com/downloads/ncp ... g-NCPA.pdf

Try testing the connectivity again with a curl command.

Code: Select all

curl -k -L -v https://<ip address>:5693