|Keep It Simple, Stupid|
Representing windows of time in a stringby Nitrox (Chaplain)
|on Oct 30, 2003 at 16:04 UTC ( #303290=perlquestion: print w/replies, xml )||Need Help??|
Nitrox has asked for the wisdom of the Perl Monks concerning the following question:
I've written an application that monitors the health of numerous servers and now I need to expand the "alerting" routine.
I'm trying to find the best way to store "windows of time" in a string (or an array of strings) (which is stored in a database and relates to the pager group that is responsible for that particular server). For example, "if server Foo fails and its currently Monday-Friday, 9:00-17:00 then page Group1".
The format that Swatch uses in it's config for the "when" option looked hopeful but only supports one "window". Here's an example: when=range_of_days:range_of_hours So if I wanted to be paged any time of the day on Saturday or Sunday the syntax would be: 7-1:1-24.
That works great for simplex windows but I already need to account for situations like:
I also thought about utilizing the crontab syntax, so I went and read through the docs for many of the Schedule::Cron::* modules. Unfortunately I didn't see "the one" that I have envisioned in my head. I'd like to pass a crontab style string to the module and have it simply return true if the passed string would currently trigger an event.
Has anyone done any projects similar to this?
Back to Seekers of Perl Wisdom