check_nt and "%"

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
rocheryderm
Posts: 69
Joined: Fri Jul 13, 2018 1:09 pm

check_nt and "%"

Post by rocheryderm »

Hello

Here is the format of my service check - it is working perfectly EXCEPT I'm having formatting issues with the output and performance data.

The following should report integers in both output and graphing, without any % signs showing up anywhere.

Code: Select all

# libexec/check_nt -H hostname-p 12489 -v COUNTER -l "\\Server\Server Sessions","Server Sessions: %.0f","Users" -w 125 -c 130

Server Sessions: 17 | 'Server Sessions: %.0f'=17.000000%;125.000000;130.000000;
Unfortunately, when I include the printf formatting "%.0f" - then the percent sign is included in the performance data and ends up in the chart - the graph then makes it look like we're graphing the percentage of sessions instead of an actual count.

If I don't include the printf formatting "%.0f" then, my graph shows values with 2 decimal positions and confuses people - "how can a fractional part of a license be in use?"

I'd rather not have to format correctly to get integers, but have "%" signs, or not format correctly and get fractional counts in the graph - in either case, I will have to answer questions every time.

Am I missing something? Is there a hidden flag or some printf-fu that will solve this problem? I've spent far too many hours with Google this afternoon.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_nt and "%"

Post by lmiltchev »

Hmm, I am not sure if this can be done with check_nt. I haven't been able to find a solution, either. :( However, it is possible that check_nrpe may work better than check_nt with NSClient++. Can you try the following command to see if it is going to work better?

Code: Select all

./check_nrpe -H <client ip> -c check_pdh -a "counter=\Server\Server Sessions" 'warn=value>125' 'crit=value>130' 'perf-config=*(suffix:none)'
Be sure to check out our Knowledgebase for helpful articles and solutions!
rocheryderm
Posts: 69
Joined: Fri Jul 13, 2018 1:09 pm

Re: check_nt and "%"

Post by rocheryderm »

Thanks for the suggestion --

I tried check_nrpe

Code: Select all

# ./check_nrpe -H <remote-server> -t 60 -p 12490 -c check_pdh -a "counter=\Server\Server Sessions" 'warn=value>1000' 'crit=value>2000' 'perf-config=*(suffix:none)'
and got this on the Nagios server

Code: Select all

CHECK_NRPE: Error - Could not connect to <remote-server>. Check system logs on <remote-server>
and this was in the nsclient event log on the remote server

Code: Select all

2019-07-12 12:08:41: error:c:\source\master\include\socket/connection.hpp:168: Failed to read data: The I/O operation has been aborted because of either a thread exit or an application request
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_nt and "%"

Post by lmiltchev »

Is port 5666 open? Run the following command on the Nagios XI server, and show the output:

Code: Select all

nmap <client ip> -p 5666
where you substitute <client ip> with the actual IP address of the Windows machine.

Also, upload the nsclient.ini file on the forum. Remove/obfuscate sensitive info.
Be sure to check out our Knowledgebase for helpful articles and solutions!
rocheryderm
Posts: 69
Joined: Fri Jul 13, 2018 1:09 pm

Re: check_nt and "%"

Post by rocheryderm »

I get responses like this:

Code: Select all

Host is up (0.00037s latency).
PORT      STATE SERVICE
12490/tcp open  unknown
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: check_nt and "%"

Post by lmiltchev »

What does it say about port 5666? I you haven't enabled NRPE listener in NSClient++, you could do this by following the document below:

https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked