Nitrox has asked for the wisdom of the Perl Monks concerning the following question:
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.If Foo fails: AND its Mon-Sat (any hour) OR its Sun !6-8 (any hour except between 6-8am) THEN page Group3
Has anyone done any projects similar to this?