[ nagiosplug-Bugs-3614897 ] check_nt COUNTER overenthusiatic isPercent test

SourceForge.net <[email protected]>
Newsgroups gmane.network.nagios.plugins.devel
Message-ID <[email protected]>
Bugs item #3614897, was opened at 2013-08-12 19:26
Message generated for change (Comment added) made by rod-payne
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3614897&group_id=29880

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Argument proccessing
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Rod Payne (rod-payne)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_nt COUNTER overenthusiatic isPercent test

Initial Comment:
Plugin Version (-V output): check_nt v1991 (nagios-plugins 1.4.13)
Plugin Name: check_nt
Plugin Commandline showing issues: -l "\\PhysicalDisk(_Total)\\Avg. Disk sec/Transfer","Seconds/transfer = %.6f","seconds" -w 1.000000 -c 2.000000

This returns performance data like: 'Seconds/transfer = %.6f&'=0.000044%;1.000000;2.000000
Note the percent sign (%) after the counter value.  This confuses the graph programs.  (%.6f is being specified because with just a clear description/label field, only two decimal places are displayed, and for this counter it mostly shows "Second/transfer = 0.00 seconds".) 

Whenever the description is formated for printf substitution ("Seconds/transfer = %.6f") in this example, the isPercent test finds the % in the description, overriding whatever may have been specified in counter_unit.  It should be looking for a % in the perfmon counter name only.

Alternately, allow the user to specify the counter_unit and override the isPercent test.  Alternately, allow the user to specify the number of decimal places in the result.

Code: (looking at line numbers in https://github.com/nagios-plugins/nagios-plugins/blob/master/plugins/check_nt.c)
----- insert after 93 -----
char *counter_name = NULL;
----- replace 339-341 -----
isPercent = (strchr (value_list, '%') != NULL);
strtok (value_list, "&");	/* burn the first parameters */
----- with -----
counter_name = strtok (value_list, "&");
isPercent = (strchr (counter_name, '%') != NULL);
-------------------


----------------------------------------------------------------------

>Comment By: Rod Payne (rod-payne)
Date: 2013-08-13 06:45

Message:
Also, the help text does not have a closing quote and mention the
counter_unit:

----- replace 736 -----
 printf ("	%s\n", _("-l \"\\\\<performance
object>\\\\counter\",\"<description>"));
----- with -----
 printf ("	%s\n", _("-l \"\\\\<performance
object>\\\\counter\",\"<description>\",\"<counter units>\""));

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=3614897&group_id=29880

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________________
Nagios Plugin Development Mailing List Nagiosplug-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
Unsubscribe at https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
::: Please include plugins version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.