[Nagiosplug-devel] Re: Patch for check_disk (was: post-1.3.0 features)
Voon, Ton
Ton.Voon at egg.com
Tue Mar 11 07:20:14 CET 2003
The example of:
<quote>
./check_disk -w 10% -c 5% -p / -w 1000 -c 500 -p /usr -w 5000 -c 3000
would warn if any partition had less than 10% free. And would warn if /
had less that 1000 kB free or if /usr had less than 5000 kB free.
</quote>
is the same in the patch that I've given as:
./check_disk -w 10% -c 5% -w 1000 -c 500 -p / -w 5000 -c 3000 -p /usr
The patch works by storing the current w_df, w_dfp, c_df and c_dfp when a -p
is encountered, so subsequent -w and -c will overwrite those values. This
kinda makes sense. The actual checking code does not change.
The reason for the -C (and I agree that it is distasteful!) is this case:
warn if ( / at 10% or 1000kB ) or ( /usr at 5% ) or ( /var at 5000kB)
One way of doing this with my patch is:
./check_disk -w 5000 -p /var -w 1000 -w 10% -p / -C -w 5% -p /usr
Without -C, -p /usr will be checked for 5% or 1000kB, but I want only a 5%
check (if you do a check_disk -v -v it will list the threshold values per
filesystem).
I have a feeling your suggestion will not cope well with this case either.
Ton
> -----Original Message-----
> From: Karl DeBisschop [SMTP:karl at debisschop.net]
> Sent: Tuesday, March 11, 2003 7:01 AM
> To: NagiosPlug Devel
> Subject: [Nagiosplug-devel] Re: Patch for check_disk (was: post-1.3.0
> features)
>
> On Fri, 2003-03-07 at 04:17, Voon, Ton wrote:
> > Can't really argue with the project administrator!
> >
> > For (3), we have a patch to check_disk, written by my colleague Andy
> Brown,
> > which we've been using here but I haven't committed to CVS because I
> wanted
> > someone else to have a look through. The patch allows different
> filesystems
> > to be monitored with different thresholds, eg:
> >
> > ./check_disk -w 10% -c 5% -p /tmp -p /var -w 5% -c 2% -p /
> >
> > This will also fulfill feature request 607885 re check_disk and quoting
> in
> > -p. check_disk will not work any differently if only one -p is passed.
> >
> > One gotcha about the way the patch is coded is that if you mix absolute
> > thresholds with percentage thresholds, then it will not check quite what
> you
> > expect:
> >
> > ./check_disk -w 10% -c 5% -p /tmp -w 1000 -c 500 -p /
> >
> > This will alert on / being < 10% OR 1000 free, when it looks like it
> should
> > check < 1000 free. My "fix" to this is a -C to clear current threshold
> > levels, so it should be:
> >
> > ./check_disk -w 10% -c 5% -p /tmp -C -w 1000 -c 500 -p /
> >
> > Is this a decent way to go? We use it here because then we can have a
> single
> > DISK_UNIX service which checks different thresholds.
>
> I find the -C a little distasteful. And I would like to be able to
> specify both absolutes and percentages for each partition.
>
> I my thinking about it, I assumed I would keep the general idea, but
> accommodate percents and absuloutes. For implementaion, it seemed lik
> ethe easiest way to do that was to increment a partition counter with
> each '-p'. So the values following would apply to that partition until
> the next '-p'
>
> By that logic, thresholds before the first '-p' would apply to all
> partitions. (It's not clear to me if they should apply as defaults or
> overrides, but I sort of think as defaults).
>
> so:
>
> ./check_disk -w 10% -c 5% -p / -w 1000 -c 500 -p /usr -w 5000 -c 3000
>
> would warn if any partition had less than 10% free. And would warn if /
> had less that 1000 kB free or if /usr had less than 5000 kB free.
>
> This seems more intuitve to me. But that could be my own bias.
>
> And it gets rid of the -C because each partition has a chace to override
> the defaults.
>
> Comments?
>
> BTW - my patches to use statfs instaed of parsing df should be more or
> less independent of this set of patches, which makes things a little
> easier.
>
> Another item - somewhere in there, we should make it possible to
> specifiy units for absolutes (B, kB, MB, GB, TB, PB should be a fairly
> complete set - antbody monitoring filesystems in sizes greater than
> petabytes?)
>
> --
> Karl
>
>
This private and confidential e-mail has been sent to you by Egg.
The Egg group of companies includes Egg Banking plc
(registered no. 2999842), Egg Financial Products Ltd (registered
no. 3319027) and Egg Investments Ltd (registered no. 3403963) which
carries out investment business on behalf of Egg and is regulated
by the Financial Services Authority.
Registered in England and Wales. Registered offices: 1 Waterhouse Square,
138-142 Holborn, London EC1N 2NA.
If you are not the intended recipient of this e-mail and have
received it in error, please notify the sender by replying with
'received in error' as the subject and then delete it from your
mailbox.
More information about the Devel
mailing list