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

SourceForge.net noreply at sourceforge.net
Tue Aug 13 13:45:10 UTC 2013


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




More information about the Nagiosplugin-devel mailing list