Patch to add timezone support for timeperiods

Andreas Ericsson ae at op5.se
Tue Feb 5 12:13:55 CET 2008


John Lemon wrote:
> Hello,
> 
> 	Below is a simple patch to add support for timezones to timeperiods.
> I see nagios 3  is now at RC2, but will post this patch in the hope it may
> make it in for the final 3 build, but if not, then the next version.
> 
> With this patch you can now define a TimeZone for a timeperiod as show below,
> this will also handle any daylight time changes etc if the systems tzdata
> files are current.
> 

Honorable intentions, and very nice if it works properly. I'm not sure doing
it the way you have is the best way to go about it though. For example, I
could very well see timezone as something one would rather want to set for
objects using timeperiods (such as hosts, services, contacts...), and then
simply creating meta-timeperiods with pre-recalculated values. I appreciate
the fact that such a patch would be quite a lot more complex, but if the
feature is to be introduced, we might as well do it properly from the start
and save ourselves the feature requests later ;-)

I'm also rather skeptical to the free use of tzset(), especially since Nagios
is a threaded application. What happens if one thread wants to log or schedule
something while another thread has TZ set to something completely bonkers?
Will the log get corrupted (= very bad)? Will the scheduled event be scheduled
several hours into the future, or perhaps even in the past?

I'm not against the functionality, but I fear there may be subtle errors that
turn out to be extremely hard to debug with the approach you've taken, and would
much prefer timeperiods to be modified when read from configuration than in-core
while Nagios is running.

-- 
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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/




More information about the Developers mailing list