Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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:

If Foo fails: AND its Mon-Sat (any hour) OR its Sun !6-8 (any hour except between 6-8am) THEN page Group3
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?

-Nitrox


In reply to Representing windows of time in a string by Nitrox

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2024-04-26 06:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found