[Nagiosplug-devel] [ nagiosplug-Patches-1531899 ] check_disk percentages fix

SourceForge.net noreply at sourceforge.net
Mon Aug 14 11:06:35 CEST 2006


Patches item #1531899, was opened at 2006-07-31 19:13
Message generated for change (Comment added) made by tonvoon
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397599&aid=1531899&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: Bugfix
Group: None
>Status: Closed
Resolution: None
Priority: 5
Submitted By: maemigh (maemigh)
>Assigned to: Ton Voon (tonvoon)
Summary: check_disk percentages fix

Initial Comment:
CVS check_disk (1.74) is outputting inode percentages
in an odd manner due to remnants of old code.  I've
created a patch to fix the output as well as add an
additional option for user choice of output.

The new option give the user the choice of printing
disk/inode percentages as % used or % free.

perfdata output still needs to be looked at.


60a61,63
> /* If nonzero, display percents as % of space used
rather than free */
> static int show_used_pct = 0;
> 
160c163
<   double dused_inodes_percent;
---
>   double dused_inodes_percent, dfree_inodes_percent;
249a253
>       dfree_inodes_percent = 100 - dused_inodes_percent;
278,286d281
<       
< 
< 
< 
<       /* Moved this computation up here so we can add it
<        * to perf */
<       inode_space_pct = (1 - dused_inodes_percent) * 100;
< 
< 
304c299
<                   dfree_pct);
---
>                   (show_used_pct ? dused_pct :
dfree_pct));
308c303
<           asprintf(&output, "%s inode=%.0f%%);",
output, (1 - dused_inodes_percent) * 100);
---
>           asprintf(&output, "%s inode=%.0f%%);",
output, (show_used_pct ? dused_inodes_percent :
dfree_inodes_percent) );
385a381
>     {"used", no_argument, 0, 'f'},
404c400
<     c = getopt_long (argc, argv,
"+?VqhveCt:c:w:K:W:u:p:x:X:mklME", longopts, &option);
---
>     c = getopt_long (argc, argv,
"+?VqhveCt:c:w:K:W:u:p:x:X:mklMEU", longopts, &option);
548a545,547
>     case 'U': /* Display output percentage as % free */
>       show_used_pct = 1;
>       break;
720a720,721
>   printf (" %s\n", "-U --used");
>   printf ("    %s\n", _("Display output percentage as
% free"));
737c738
<   printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q]
[-E]\n");
---
>   printf ("[-m] [-e] [-W limit] [-K limit] [-v] [-q]
[-E] [-U]\n");

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

>Comment By: Ton Voon (tonvoon)
Date: 2006-08-14 10:06

Message:
Logged In: YES 
user_id=664364

Mike,

Thanks for the patch. Have applied to CVS. However, I've removed the -U option 
because we'll be changing the way to specify plugin output in 1.5.

For information, we prefer diff -u output as it is easier to understand the patch.

Ton

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

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




More information about the Devel mailing list