Page 1 of 2

NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Sat Mar 16, 2019 8:48 pm
by corkyman
This week I upgraded NCPA from 1.8.1 to 2.1.6 and my windowscounters service checks started to fail with CRITICAL alert.
I originally ran it with -u k parameter. I did not set it up and looking at the scarce documentation I can guess that it was supposed to return the number in kilobytes. It looks like after 2.1.6 upgrade this parameter is ignored and the value returned is in bytes. Please see various combinations I ran on my system. The return value is the same.

[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000
CRITICAL: \Process(javaservice)\Working Set was 670457856.00 Working Set | '\Process(javaservice)\Working Set'=670457856.00;;150000:1250000;
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 -u k
CRITICAL: \Process(javaservice)\Working Set was 667246592.00 Working Set | '\Process(javaservice)\Working Set'=667246592.00;;150000:1250000;
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 -u M
CRITICAL: \Process(javaservice)\Working Set was 665808896.00 Working Set | '\Process(javaservice)\Working Set'=665808896.00;;150000:1250000;
[c601018@vhlgnngxi001 ~]$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 -u Mi
CRITICAL: \Process(javaservice)\Working Set was 666300416.00 Working Set | '\Process(javaservice)\Working Set'=666300416.00;;150000:1250000;
[c601018@vhlgnngxi001 ~]$

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Mon Mar 18, 2019 10:56 am
by cdienger
What veresion of check_ncpa is on the XI server? You can find out by running /usr/local/nagios/libexec/check_ncpa --help. The /usr/local/nagios/libexec/check_ncpa --help command shows the options available including -u:
-u, --unknown-timeout Make connection problems return UNKNOWN instead of CRITICAL
and I'm not aware of this changing. It may have be set up incorrectly with this assumption of -u, but now it looks legit. The -c option defines the critical threshold.

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Mon Mar 18, 2019 11:01 am
by cdienger
Actually, it may have been covered in the Changes from 1.x to 2.x section of https://www.nagios.org/ncpa/help.php. Try running the command with the --unit option. This adjusts the value returned though so the the thresholds would still need to be adjusted.

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Mon Mar 18, 2019 12:18 pm
by corkyman
The check-ncpa version is:
check_ncpa.py, Version 1.1.3

I tried to use --units instead of -u and it worked the same way--the parameter is ignored. Tried several variations:

-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000
CRITICAL: \Process(javaservice)\Working Set was 708136960.00 Working Set | '\Process(javaservice)\Working Set'=708136960.00;;150000:1250000;
You have mail in /var/spool/mail/nagios

-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 --units k
CRITICAL: \Process(javaservice)\Working Set was 716374016.00 Working Set | '\Process(javaservice)\Working Set'=716374016.00;;150000:1250000;

-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 --units M
CRITICAL: \Process(javaservice)\Working Set was 719273984.00 Working Set | '\Process(javaservice)\Working Set'=719273984.00;;150000:1250000;
You have mail in /var/spool/mail/nagios

-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 --units Ki
CRITICAL: \Process(javaservice)\Working Set was 715522048.00 Working Set | '\Process(javaservice)\Working Set'=715522048.00;;150000:1250000;

Tried an invalid value and still the same result:
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 --units ddddd
CRITICAL: \Process(javaservice)\Working Set was 709955584.00 Working Set | '\Process(javaservice)\Working Set'=709955584.00;;150000:1250000;

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Mon Mar 18, 2019 1:14 pm
by cdienger
Download the new plugin at https://github.com/NagiosEnterprises/nc ... ck_ncpa.py. The option is --unit and not --units (with a s).

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Mon Mar 18, 2019 1:53 pm
by corkyman
I want to use the '-u' parameter so corresponding switch is '--units'. Switch '--unit' corresponds to '-n' which i do not want.

-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py --help
Usage: check_ncpa.py [options]

Options:
-h, --help show this help message and exit
-H HOSTNAME, --hostname=HOSTNAME
The hostname to be connected to.
-M METRIC, --metric=METRIC
The metric to check, this is defined on client system.
This would also be the plugin name in the plugins
directory. Do not attach arguments to it, use the -a
directive for that. DO NOT INCLUDE the api/
instruction.
-P PORT, --port=PORT Port to use to connect to the client.
-w WARNING, --warning=WARNING
Warning value to be passed for the check.
-c CRITICAL, --critical=CRITICAL
Critical value to be passed for the check.
-u UNITS, --units=UNITS
The unit prefix (k, Ki, M, Mi, G, Gi, T, Ti) for b and
B unit types which calculates the value returned.
-n UNIT, --unit=UNIT Overrides the unit with whatever unit you define. Does
not perform calculations. This changes the unit of
measurement only.
-a ARGUMENTS, --arguments=ARGUMENTS
Arguments for the plugin to be run. Not necessary
unless you're running a custom plugin. Given in the
same as you would call from the command line. Example:
-a '-w 10 -c 20 -f /usr/local'
-t TOKEN, --token=TOKEN
The token for connecting.
-T TIMEOUT, --timeout=TIMEOUT
Enforced timeout, will terminate plugins after this
amount of seconds. [60]
-d, --delta Signals that this check is a delta check and a local
state will kept.
-l, --list List all values under a given node. Do not perform a
check.
-v, --verbose Print more verbose error messages.
-D, --debug Print LOTS of error messages. Used mostly for
debugging.
-V, --version Print version number of plugin.
-q QUERYARGS, --queryargs=QUERYARGS
Extra query arguments to pass in the NCPA URL.
-s, --secure Require successful certificate verification. Does not
work on Python < 2.7.9.
-p, --performance Print performance data even when there is none. Will
print data matching the return code of this script
You have mail in /var/spool/mail/nagios
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py --help

I'll try the new plugin.

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Mon Mar 18, 2019 2:12 pm
by corkyman
There is no difference in how new ncpa check 1.1.5 worked (first one executed below was check_ncpa.py and the second was new check_ncpa_115.py)

-bash-4.1$ /usr/local/nagios/libexec/check_ncpa.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 --units M
CRITICAL: \Process(javaservice)\Working Set was 729026560.00 Working Set | '\Process(javaservice)\Working Set'=729026560.00;;150000:1250000;
-bash-4.1$ /usr/local/nagios/libexec/check_ncpa_115.py -H IMPSHPPNDS1120V.TVLPORT.NET -t wspwebfarm -M 'windowscounters/Process(javaservice)/Working Set' -c 150000:1250000 --units M
CRITICAL: \Process(javaservice)\Working Set was 728477696.00 Working Set | '\Process(javaservice)\Working Set'=728477696.00;;150000:1250000;
You have mail in /var/spool/mail/nagios
-bash-4.1$

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Mon Mar 18, 2019 5:00 pm
by cdienger
Apologies, I was somehow looking at the wrong --help. I've been able to reproduce and this does appear to be a bug. I will follow up with our dev team and let you know.

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Tue Mar 19, 2019 10:49 am
by cdienger
Checked with the dev team and this is a known limitation - the unit option for the check_ncpa plugin doesn't work with counters and this is currently a feature request.

Re: NCPA 2.1.6 windowscounters API ignores -u parameter

Posted: Wed Mar 20, 2019 10:51 am
by corkyman
Please clarify which one are you taking about?

-u UNITS, --units=UNITS
The unit prefix (k, Ki, M, Mi, G, Gi, T, Ti) for b and
B unit types which calculates the value returned.
-n UNIT, --unit=UNIT Overrides the unit with whatever unit you define. Does
not perform calculations. This changes the unit of
measurement only.

I am interested in -u UNITS that was working in 1.8.1. How come it is a 'limitation' when it worked before and now it does not?