[PATCH] config.c notification_interval vs check_interval check assuming wrong interval_length

Andreas Ericsson ae at op5.se
Sun Sep 21 14:57:32 CEST 2008


Marcel wrote:
> Hi there,
> 
> I don't know if this solution would be the best solution to this problem,
> but I've patched config.c to correct a problem in verification of
> notification_interval versus check_interval, which when configuring
> "interval_length=1", the check of notification_interval versus
> check_interval issues wrong warning at nagios.log.
> 
> Here is the patch:
> 

Hi Marcel. First off; Well spotted. Thanks.

While I approve of obvious bugfix patches, I'm slightly against this
one anyway, as I believe a much better fix would be to keep the
interval_length a mere syntactic sugar for the configuration parsing.

Nagios would be better off storing all intervals as the actual number
of seconds between the two checks. In other words, the multiplication
should only ever happen when reading the configuration and all other
comparisons should look like this:

if (service->notification_interval < service->check_interval)
	/* bogus */ ;

Mucking around with interval length inside the core logic makes
for mistakes such as this one. I'll see if I can cook up a patch
that makes it so and then get Ethan to accept it.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/




More information about the Developers mailing list