Hi, Our on-call staff spent the night watching swatch yammer to them over their alpha pagers about a DHCP pool having exhuasted its available leases. Now, that is an important event, and I want to hear about it ... but not at two o'clock in the morning. So I'm wanting to figure out a way to modify how swatch to suppress some actions depending on the time of day/day of the week. I'm wondering how other people solve this problem. Would you be willing to tell me how you do it? Our network monitoring package, NodeWatch (http://www.skendric.com/nodewatch) does this ... but of course, we wrote it, so of course it does. Its equivalent of the "exec" line in swatch comes coupled with a "period" modifier ... periods are defined in a seperate config file ... if "now" fits inside the specified "period", then NodeWatch executes the command ... if not, then NodeWatch ignores the command. This works well for us, but I don't see a way to hack this into swatch without more work than my sleepy little mind can handle at the moment. Early this morning, I hacked together a little script to do this for me. I use this as the argument for the "exec" line in swatch.conf. Basically, it takes two arguments -- the group to page and the message to send them -- and before sending the page ... it checks to see if "now" fits within the 8:00am - 5:00pm time slot. let_me_sleep: #!/opt/local/bin/perl # This is a hack to introduce into swatch the NodeWatch 'period' # functionality, # i.e. to allow us to suppress actions (well, specifically alpha pages) # depending on the time of the day. # This script currently hard-codes the period # Who When What # --------------------------------------------------------------------------- # skendric 08-24-2001 First version use Getopt::Std; use Time::Period; # Gather options $usage = "usage: let_me_sleep -m \"Message\"\n"; getopts("g:m:") || die $usage; $group = $opt_g; $msg = $opt_m; # Define variables @args = ($group, $msg); $period = "wday {Mon-Su} hour {8am-5pm}"; $now = time(); # Send page if I'm not sleeping if (inPeriod($now, $period) == 1) { system ("/opt/local/bin/qpage", @args); if ($? != 0) {die ("$0 failed to send a page") } } I would enjoy hearing how other folks handle this kind of issue ... basically, an event which is important enough to be worth paging us for ... but not important enough to warrant being woken up for. --sk Stuart Kendrick FHCRC --------------------------------------------------------------------- To unsubscribe, e-mail: loganalysis-unsubscribeat_private For additional commands, e-mail: loganalysis-helpat_private
This archive was generated by hypermail 2b30 : Fri Aug 24 2001 - 10:42:22 PDT