[Nagiosplug-devel] comparisons of -w and -c

Andreas Ericsson ae at op5.se
Thu May 5 13:44:58 CEST 2005


sean finney wrote:
> hi,
> 
> On Thu, May 05, 2005 at 10:09:17PM +0200, Andreas Ericsson wrote:
> 
>>Josh wrote:
>>
>>>The check_disk and check_swap plugins error if -w is *less* than -c - it 
>>>should
>>>be the other way around. (this still is true in the most recent CVS)
>>>
>>
>>No it should not, since they report (and warn) on how much space (in 
>>percent) that is free. It's a common misconception.
> 
> 
> and this behaviour has changed *at least* once in the past, if not more.
> 
> honestly, for the sake of stability and consistancy i'd suggest leaving
> it as it is.  it might be nice to have a flag that let you select what
> you'd like to check (% left/used and Gb/Mb left/used, like the -T in
> check_snmp_storage), but otherwise i think it's fine the way it is.
> 

What's really needed is something like a general functionality to check 
if one value is greater than the other and evaluate it intelligently, 
like so;

/* eval thresholds in a somewhat clever manner */
inline int nplug_thresh_match(warn, crit, value) {
   if(crit <= warn) {
     if(value <= crit) return STATE_CRITICAL;
     if(value <= warn) return STATE_WARNING;
   }

   if(crit >= warn) {
     if(value >= crit) return STATE_CRITICAL;
     if(value >= warn) return STATE_WARNING;
   }

   return STATE_OK;
}

This should ofcourse be called once for each threshold type (several 
disks at once, fe).

Also, check_{disk,mem,swap} and friends should be made to accept a 
prefix to the threshold arguments, such as %, MB et al. They should also 
follow the path of least surprise for the end user.

I've never quite understood why there are a plethora of various 
functions for exiting while reporting user errors when there are none 
that actually work around user stupidity.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer




More information about the Devel mailing list