NCPA windowscounters Errors

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
benpickhardt
Posts: 4
Joined: Wed May 22, 2019 5:12 pm

NCPA windowscounters Errors

Post by benpickhardt »

I've been working on trying to get some checks to work on some windows counters with NCPA for the better part of the last two days. Some of the ones I want to monitor have worked but a number have not. I've seen a few posts of people having similar problems but none of their solutions seem to work for me. The issue I have is that when I use the counters in Nagios XI I get back the result of "0 c". I did a bunch of testing via Nagios before I realized I could go hit the API directly on the client machine. The API gives me the error message "Error: The data is not valid". I've tried using the NCPA agent version 2.1.6 and 2.1.7 and they both had the same behavior on a Windows 2012 R2 server. Below are the paths I tried to run via the API that gave me this error.
  • /LogicalDisk(C:)/Avg. Disk Queue Length
    /PhysicalDisk(0 C:)/Avg. Disk Queue Length
    /LogicalDisk(_total)/Avg. Disk Queue Length
    /PhysicalDisk(_total)/Avg. Disk Queue Length
    /ASP.NET Applications(__total__)/Requests/Sec
    /ASP.NET Applications(__total__)/Errors Total/Sec
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NCPA windowscounters Errors

Post by npolovenko »

@benpickhardt, I also used the API to test out queries against counters. All the following queries worked for me:

Code: Select all

./check_ncpa.py -H 192.168.3.145 -t '<your token>' -M 'windowscounters/LogicalDisk(C:)/Avg. Disk Queue Length'
./check_ncpa.py -H 192.168.3.145 -t '<your token>' -M 'windowscounters/LogicalDisk(C:)/Avg. Disk Write Queue Length'
./check_ncpa.py -H 192.168.3.145 -t '<your token>' -M 'windowscounters/PhysicalDisk/Avg. Disk Write Queue Length'
./check_ncpa.py -H 192.168.3.145 -t '<your token>' -M 'windowscounters/LogicalDisk/Avg. Disk Write Queue Length'
./check_ncpa.py -H 192.168.3.145 -t '<your token>' -M 'windowscounters/ASP.NET Applications/Requests/Sec'
./check_ncpa.py -H 192.168.3.145 -t '<your token>' -M 'windowscounters/ASP.NET Applications/Errors/Sec'
Can you open the PerfMon application on the Windows Server and make sure that these counters actually exist and returning valid data? Right click on the screen, select Add Counters and try adding counters to the PerfMon graph.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
benpickhardt
Posts: 4
Joined: Wed May 22, 2019 5:12 pm

Re: NCPA windowscounters Errors

Post by benpickhardt »

I had tested that the counters existed using powershell and that they returned results. However when i check them with the check_ncpa plugin they always return a result like the following.

Code: Select all

OK: \LogicalDisk(C:)\Avg. Disk Queue Length was 0 c | '\LogicalDisk(C:)\Avg. Disk Queue Length'=0c;50;100;
When you use the web interface on the server on port 5693 and don't check "Run as a Nagios check" you get the below response back.

Code: Select all

{
    "windowscounters": [
        [
            "Error: The data is not valid."
        ],
        "c"
    ]
}
However, if I change the spelling on the counter to make it not exist I get a different error, shown below, so I know it is finding the counter correctly it just can't for some reason read the result.

Code: Select all

{
    "windowscounters": [
        [
            "Error: The specified counter could not be found."
        ],
        "c"
    ]
}
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NCPA windowscounters Errors

Post by ssax »

Please ignore the web interface for now, do the plugin commands work properly that npolovenko posted from the command line of the XI server?

If so, that means it's just an escaping issue (or bug) in the web interface code.
benpickhardt
Posts: 4
Joined: Wed May 22, 2019 5:12 pm

Re: NCPA windowscounters Errors

Post by benpickhardt »

No, that first code block I posted is the response from the Linux plugin being called directly from the command line not the API. If it was just a spacing issue I don't think it would say "0 c" when the counter itself is 1 or higher. To test this I did a shrink on a large database on our test database server that generated a significant disk load and compared the PowerShell counter lookup against the plugin counter called from the Nagios Linux Server command line, NOT the API. the result is I always get "0 c" as the result.

Code: Select all

get-counter '\LogicalDisk(D:)\Avg. Disk Queue Length'
Timestamp                 CounterSamples
---------                 --------------
5/28/2019 4:21:28 PM      \\server\logicaldisk(d:)\avg. disk queue length :
                          44.352111885799

Code: Select all

#./check_ncpa.py -H <IP> -t <token>' -M 'windowscounters/LogicalDisk(D:)/Avg. Disk Queue Length'
OK: \LogicalDisk(D:)\Avg. Disk Queue Length was 0 c | '\LogicalDisk(D:)\Avg. Disk Queue Length'=0c;;;
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: NCPA windowscounters Errors

Post by ssax »

Does this one output anything different?

Code: Select all

./check_ncpa.py -H <IP> -t '<token>' -M 'windowscounters/LogicalDisk(D|)/Avg. Disk Queue Length'
vana1
Posts: 3
Joined: Mon May 13, 2019 8:39 am

Re: NCPA windowscounters Errors

Post by vana1 »

I am as well facing the same issue for disk queue length and disk transfer.

Tried the following as
windowscounters/LogicalDisk(D|)/Avg. Disk Queue Length and it provided the following output.

OK: LogicalDisk(D/)Avg. was 0 c
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NCPA windowscounters Errors

Post by npolovenko »

@vana1, First, please update the NCPA agent on the monitored server to version 2.1.7:
https://www.nagios.org/ncpa/#downloads

Then run this query:

Code: Select all

./check_ncpa.py -H <IP> -t '<token>' -M 'windowscounters/LogicalDisk(D:)/Avg. Disk Queue Length' -q 'sleep=5'
Let me know if it starts to show valid data.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
benpickhardt
Posts: 4
Joined: Wed May 22, 2019 5:12 pm

Re: NCPA windowscounters Errors

Post by benpickhardt »

Adding that sleep to the end of the queries solved it for me. Any idea why that is the case for some counters and not others?

Code: Select all

-q 'sleep=1'
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: NCPA windowscounters Errors

Post by npolovenko »

@benpickhardt, To pull the info from some counters NCPA needs to calculate the delta value to see a change over the period of time.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked