Bug fix priority

Hiren Patel hir3npatel at gmail.com
Sun Aug 16 17:30:59 CEST 2009


Ethan Galstad wrote:
> There have been a couple of bugs related to timeperiods and scheduling
> lately.  One was fixed in yesterday's CVS commit.
> 
> As far as I can tell, there is a big bug in check scheduling when a
> timeperiod is used that contains an "exclude" directive.  The scheduling
> logic will incorrectly schedule the next check too far into the future,
> when earlier scheduling is possible.
> 
> Proposed patches to this point have been incorrect, as the real solution
> is much more complex.  I believe I know what needs to be done to solve
> the issue, but it will require some time to architect/code the right
> solution.  I'll work on getting this fix into the 3.4 release and mark
> it as a "known issue" for the time being.
> 

I've been trying to work on a fix for this, please let me know what you 
think of the attached diff.
I've effectively left the get_next_valid_time function invocation as is, 
and adjusted it to call a recursive function that will run through a 
timeperiod and all its exclusions.
I've moved the code to get the next earliest time to a function called 
get_next_valid_time_per_timeperiod, and have added a function called 
get_min_invalid_time_per_timeperiod which gets the earliest end_time 
from preferred time for a timeperiod.

since a given timeperiod is inclusive, and its excludes are exclusive, 
but the excludes` excludes are inclusive (and so on), the recursive 
function get_earliest_time bumps a variable called level before 
processing each excludes, and this is used to determine if the 
timeperiod in question is an include or exclude in the context.

depending on this, the two different functions are called, one fetching 
the earliest time as per previous code (which may not be the earliest 
possible time as you noted above), and one fetching the earliest 
end_time of exclusions. the smallest value found is then used as the 
next valid time.

I've done very basic testing only with weekdays (sunday 00:00-09:00 etc) 
and with exclusions, and also so far with one type of daterange 
exception (day 16 12:00-21:00) also with exclusions.

the configuration for the simple testing I was doing is attached. if you 
are okay with it working this way, could we test all possible daterange 
types, I'll be happy to do this.

let me know what you think of it, if it's acceptable, I'll happily 
consider taking configurations from people using complex timeperiods to 
test this further.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: utils.diff
Type: text/x-patch
Size: 20065 bytes
Desc: not available
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20090816/e4a24674/attachment.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: timeperiods.cfg
URL: <https://www.monitoring-lists.org/archive/developers/attachments/20090816/e4a24674/attachment.ksh>
-------------- next part --------------
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
-------------- next part --------------
_______________________________________________
Nagios-devel mailing list
Nagios-devel at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-devel


More information about the Developers mailing list