[Nagiosplug-devel] Fwd: check_disk with inode usage?

Ben O'Hara bohara at gmail.com
Mon Oct 31 07:06:43 CET 2005


So,
   I found the original patch and have attached a patch against the
latest HEAD release of check_disk.c

This appears to work with no problems from limited testing on solaris
7,8,9 boxes.

Could this be applied to CVS?

Regards

Ben

---------- Forwarded message ----------
From: Ben O'Hara <bohara at gmail.com>
Date: Oct 31, 2005 2:28 PM
Subject: Re: check_disk with inode usage?
To: nagiosplug-help at lists.sourceforge.net


And to followup on my own post, the tracker item is at

https://sourceforge.net/tracker/?func=detail&atid=397599&aid=995761&group_id=29880

Doesnt look like it ever got actioned...any reason? Can it be mergted into CVS?

Ben

On 10/31/05, Ben O'Hara <bohara at gmail.com> wrote:
> Hey Guys,
>
> Ive installed nagiosgraph, and their "map" file mentions a check_disk
> patch which also checks inode usage.
>
> Im currently using seperate checks for both disk/inode usage and would
> like to merge them into one check.
>
> Anyone know anything about this patch? Looks to have been submitted
> back in 2004 but ive checked out the latest cvs head and it doesnt
> seem to be included.
>
> ./plugins/check_disk.c contains
>
> /* If nonzero, show inode information. */
> /* static int inode_format; */
>
> Although these are obviously commented out i cant find any other
> mention of inode or inode_format in the code.
>
> Did this ever get patched into CVS?
>
> Cheers
>
> Ben
> --
> "There are 10 types of IT people. Those who understand binary and
> those who don't."
>


--
"There are 10 types of IT people. Those who understand binary and
those who don't."


--
"There are 10 types of IT people. Those who understand binary and
those who don't."
-------------- next part --------------
26a27,31
>  /*
>   * Additional inode code by Jorgen Lundman <lundman at lundman.net>
>   */
>
>
42c47
< /* static int inode_format; */
---
> static int inode_format;
71a77,78
>   double w_idfp;
>   double c_idfp;
117,118c124,125
< int validate_arguments (uintmax_t, uintmax_t, double, double, char *);
< int check_disk (double usp, double free_disk);
---
> int validate_arguments (uintmax_t, uintmax_t, double, double, double, double, char *);
> int check_disk (double usp, uintmax_t free_disk, double uisp);
126a134,135
> double w_idfp = -1.0;
> double c_idfp = -1.0;
143c152
<       double usp = -1.0;
---
>       double usp = -1.0, uisp = -1.0;
151c160
<       float free_space, free_space_pct, total_space;
---
>       float free_space, free_space_pct, total_space, inode_space_pct;
223c232,235
<                       disk_result = check_disk (usp, (double)(fsp.fsu_bavail * fsp.fsu_blocksize / mult));
---
>                         uisp = (double)(fsp.fsu_files - fsp.fsu_ffree) * 100 / fsp.fsu_files;
>                       disk_result = check_disk (usp, fsp.fsu_bavail, uisp);
>
>
225a238,244
>
>
>                         /* Moved this computation up here so we can add it
>                          * to perf */
>                         inode_space_pct = (float)fsp.fsu_ffree*100/fsp.fsu_files;
>
>
231c250,251
<                                           TRUE, 0,
---
>                                             TRUE, inode_space_pct,
>
240c260
<                               asprintf (&output, ("%s %s %.0f %s (%.0f%%);"),
---
>                               asprintf (&output, ("%s %s %.0f %s (%.0f%% inode=%.0f%%);"),
245c265,267
<                                                                       free_space_pct);
---
>                                         free_space_pct,
>                                         inode_space_pct);
>
247,248c269,270
< %.0f of %.0f %s (%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
<                                 details, free_space, total_space, units, free_space_pct,
---
> %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"),
>                                 details, free_space, total_space, units, free_space_pct, inode_space_pct,
250a273
>
294a318,320
>               {"iwarning", required_argument, 0, 'W'},
>               /* Dang, -C is taken. We might want to reshuffle this. */
>               {"icritical", required_argument, 0, 'K'},
329c355
<               c = getopt_long (argc, argv, "+?VqhveCt:c:w:u:p:x:X:mklM", longopts, &option);
---
>               c = getopt_long (argc, argv, "+?VqhveCt:c:w:K:W:u:p:x:X:mklM", longopts, &option);
376a403,418
>
>
>                 case 'W':                                                                       /* warning inode threshold */
>                         if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &w_idfp) == 1) {
>                         break;
>                         }
>                         else {
>                               usage (_("Warning inode threshold must be percentage!\n"));
>                       }
>                 case 'K':                                                                       /* kritical inode threshold */
>                         if (strstr (optarg, "%") && sscanf (optarg, "%lf%%", &c_idfp) == 1) {
>                         break;
>                         }
>                         else {
>                               usage (_("Critical inode threshold must be percentage!\n"));
>                        }
433,436c475,483
<                       se->w_df = 0;
<                       se->c_df = 0;
<                       se->w_dfp = -1.0;
<                       se->c_dfp = -1.0;
---
>
>                         /* If you don't clear the w_fd etc values here, they
>                          * get processed when you walk the list and assigned
>                          * to the global w_df!
>                          */
>                         se->w_df = 0;
>                         se->c_df = 0;
>                         se->w_dfp = 0;
>                         se->c_dfp = 0;
446,449c493,500
<                       se->w_df = 0;
<                       se->c_df = 0;
<                       se->w_dfp = -1.0;
<                       se->c_dfp = -1.0;
---
>                         /* If you don't clear the w_fd etc values here, they
>                          * get processed when you walk the list and assigned
>                          * to the global w_df!
>                          */
>                         se->w_df = 0;
>                         se->c_df = 0;
>                         se->w_dfp = 0;
>                         se->c_dfp = 0;
511a563,564
>                                                     temp_list->w_idfp,
>                                                     temp_list->c_idfp,
518c571
<               return validate_arguments (w_df, c_df, w_dfp, c_dfp, NULL);
---
>               return validate_arguments (w_df, c_df, w_dfp, c_dfp, w_idfp, c_idfp, NULL);
538c591
< validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath)
---
> validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, double iwp, double icp, char *mypath)
552a606,613
>       else if ((iwp >= 0.0 || icp >= 0.0) &&
>                (iwp < 0.0 || icp < 0.0 || iwp > 100.0 || icp > 100.0 || icp > iwp)) {
>               printf (_("\
> INPUT ERROR: C_IDFP (%f) should be less than W_IDFP (%.1f) and both should be between zero and 100 percent, inclusive"),
>                       icp, iwp);
>               print_path (mypath);
>               return ERROR;
>       }
571c632,633
< check_disk (double usp, double free_disk)
---
>
> check_disk (double usp, uintmax_t free_disk, double uisp)
573,583c635,649
<       int result = STATE_UNKNOWN;
<       /* check the percent used space against thresholds */
<       if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp))
<               result = STATE_CRITICAL;
<       else if (c_df > 0 && free_disk <= c_df)
<               result = STATE_CRITICAL;
<       else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp))
<               result = STATE_WARNING;
<       else if (w_df > 0 && free_disk <= w_df)
<               result = STATE_WARNING;
<       else if (usp >= 0.0)
---
>        int result = STATE_UNKNOWN;
>        /* check the percent used space against thresholds */
>        if (usp >= 0.0 && c_dfp >=0.0 && usp >= (100.0 - c_dfp))
>                result = STATE_CRITICAL;
>        else if (uisp >= 0.0 && c_idfp >=0.0 && uisp >= (100.0 - c_idfp))
>                result = STATE_CRITICAL;
>        else if (c_df > 0 && free_disk <= c_df)
>                result = STATE_CRITICAL;
>        else if (usp >= 0.0 && w_dfp >=0.0 && usp >= (100.0 - w_dfp))
>                result = STATE_WARNING;
>        else if (uisp >= 0.0 && w_idfp >=0.0 && uisp >= (100.0 - w_idfp))
>                result = STATE_WARNING;
>        else if (w_df > 0 && free_disk <= w_df)
>                result = STATE_WARNING;
>        else if (usp >= 0.0)
637a704,707
>  -W, --iwarning=PERCENT%%\n\
>    Exit with WARNING status if less than PERCENT of inode space is free\n\
>  -K, --icritical=PERCENT%%\n\
>    Exit with CRITICAL status if less than PERCENT of inode space is free\n\
686c756
< Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e]\n\
---
> Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e] [-W limit] [-K limit]\n\


More information about the Devel mailing list