[Nagiosplug-devel] bug? in perl Plugin::Range.pm

Gavin Carr gavin at openfusion.com.au
Fri Feb 9 00:21:50 CET 2007


On Thu, Feb 08, 2007 at 09:27:43AM +0000, Ton Voon wrote:
> 
> On 8 Feb 2007, at 07:32, Norman J Harman Jr. wrote:
> 
> > $VERSION = "0.15";
> >
> > I'm fairly certain that the first if/else in check_range should be  
> > swapped.
> >
> > Correct code:
> >
> > sub check_range {
> > ...
> >    if ($self->end_infinity == 0 && $self->start_infinity == 0) {
> >      if ($self->start <= $value && $value <= $self->end) {
> >        return $true;
> >      } else {
> >        return $false;
> > ...
> >
> 
> Good news: the code is right. Bad news: the design is wrong.
> 
> According to the developer guidelines (http:// 
> nagiosplug.sourceforge.net/developer-guidelines.html), a range of  
> 5:10 will alert on 12, but not 7. This goes against "conventional"  
> thinking, where you would expect a range to alert inside.  
> Nagios::Plugin has been coded in accordance with the design.

Blech - this is so broken, isn't it?

> There is a discussion re: new style range setting, to try and fix  
> this, but the thread has stalled (http://thread.gmane.org/ 
> gmane.network.nagios.plugins.devel/4461). I plan on tackling this  
> when the other RFC re: plugins config files is completed.

How are you thinking of doing this on the backend Ton? Do we want a
flag on N::P::Range to designate whether a range is inclusive or 
exclusive, and support in N::P::Threshold for that?

That might allow plugins to explicitly designate which way they want
their ranges to be interpreted. I've got current plugins in the wild
with inclusive ranges that I can't migrate to N::P::Range because of
this.

Cheers,
Gavin





More information about the Devel mailing list