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

Ton Voon ton.voon at altinity.com
Thu Feb 8 10:27:43 CET 2007


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;
> ...
>

Hi Norman,

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.

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.

Ton

http://www.altinity.com
T: +44 (0)870 787 9243
F: +44 (0)845 280 1725
Skype: tonvoon






More information about the Devel mailing list