Hey lmiltchev,
I am on the same version 2.1.3 and I still think something is not right.
I see you ran this as a Nagios Check and yes if I do that it too returns a value.
But look at your return, what is the "c" doing as part of your value...that does not appear to be a reliable return value.
If you remove the "Run as a Nagios check" the response cannot be handled appropriately as shown in the error message and look there is that weird lowercase "c" character again...it just happens that the "Run as a Nagios check" is just accepting the return value as a string and it doesn't care that the "0c" is not an actual integer and it is just passing it as ascii text.
Code: Select all
{
"windowscounters": [
[
"Error: The specified object was not found on the computer."
],
"c"
]
}
If you use the following Powershell query look at the returns.
I still believe this is broke as the actual value being returned is an integer and the "c" I believe is being reported back by the .Countersamples.
It appears to me that the parser is confused and is somehow grabbing the InstanceName as that lowercase "c" appears to be the only place it is originating from...DEBUG from the listener does not give me enough to really know what is happening and I think only the developer will really understand what is happening here...I included the DEBUG out below.
Code: Select all
PS C:\> (Get-Counter "\PhysicalDisk(*)\Avg. Disk sec/Transfer").Countersamples
Path InstanceName CookedValue
---- ------------ -----------
\\dg0123-ibm-4048\physicaldisk(0 c:)\avg. disk sec/transfer 0 c: 0.000166624356556804
\\dg0123-ibm-4048\physicaldisk(_total)\avg. disk sec/transfer _total 0.000166624356556804
listener.log DEBUG output:
CHECK=FALSE
2018-05-11 12:50:08,851:INFO:handler:127.0.0.1 - - [2018-05-11 12:50:08] "GET /api/windowscounters/PhysicalDisk(_Total)/Avg.%20Disk%20sec/Transfer HTTP/1.1" 200 382 0.208000
2018-05-11 12:50:11,362:DEBUG:handler:Initializing WebSocket
2018-05-11 12:50:11,364:DEBUG:handler:Validating WebSocket request
2018-05-11 12:50:11,382:DEBUG:psapi:Imported windowscounters into the API tree.
2018-05-11 12:50:11,384:DEBUG:psapi:Imported windowslogs into the API tree.
2018-05-11 12:50:11,384:ERROR:windowscounters:(-1073738824, 'AddCounter', 'The specified object was not found on the computer.')
Traceback (most recent call last):
File "C:\ncpa\agent\listener\windowscounters.py", line 43, in counter_method
File "C:\ncpa\agent\listener\windowscounters.py", line 59, in get_counter_val
error: (-1073738824, 'AddCounter', 'The specified object was not found on the computer.')
CHECK=TRUE
2018-05-11 12:50:11,500:INFO:handler:127.0.0.1 - - [2018-05-11 12:50:11] "GET /api/windowscounters/PhysicalDisk(_Total)/Avg.%20Disk%20sec/Transfer?check=true HTTP/1.1" 200 441 0.137000
2018-05-11 12:50:13,585:DEBUG:handler:Initializing WebSocket
2018-05-11 12:50:13,585:DEBUG:handler:Validating WebSocket request
2018-05-11 12:50:13,607:DEBUG:psapi:Imported windowscounters into the API tree.
2018-05-11 12:50:13,607:DEBUG:psapi:Imported windowslogs into the API tree.
2018-05-11 12:50:13,608:INFO:handler:127.0.0.1 - - [2018-05-11 12:50:13] "GET /api/windowscounters/PhysicalDisk(_Total)/Avg.%20Disk%20sec/Transfer HTTP/1.1" 200 382 0.023000
Thanks for your help,
Danny