Suspending Alarms
[posted 2000/06/19]
From time to time, I find myself temporarily suspending alarms for one reason or another. Usually, I've been going into alerts.cfg and commenting out the alarm listing (using '//'). That's fine, except that I then forget to reactivate the alarm, and weeks will pass before I notice the inactivity.
I think I have a better way. From now on, whenever I want to suspend an alarm's operation, I'll set its status field in alarms.cfg to "inactive". In addition, I've applied the following patch to my pikt binaries:
vienna# diff -C 1 /pikt/bak/src/piktd.000621/pikt.c $P/src/piktd/pikt.c *** /pikt/bak/src/piktd.000621/pikt.c Sat Jun 3 19:52:20 2000 --- /export/home/berto/ucgsb/pikt/src/piktd/pikt.c Wed Jun 21 06:56:00 2000 *************** *** 375,378 **** foreach (alarmcurr, alarms) { ! if (STATUS == INACTIVE) continue; if (beginscript() == ERROR) --- 375,380 ---- foreach (alarmcurr, alarms) { ! if (STATUS == INACTIVE) { ! logreturn(PIKTLOG, LOG_WARNING, __FILE__, __LINE__, FALSE, "%s alarm inactive", ALMNAM); continue; + } if (beginscript() == ERROR)
From now on, whenever pikt sees an alarm's status set to "inactive", it will as usual skip that alarm but now, in addition, it will log a WARNING message to the alarm's .log file. I can then monitor this in, for example, PiktWarningLogChk with the rule:
rule // report inactive alarms if $inline =~ "WARNING:.+alarm inactive" =outputmail $inline next endif
I might use =stifle() or some other means if repeated alerts for this get to be too much of a nuisance.
Another way one might handle this is to keep the status "active" but add this at the beginning of the script:
begin if #weekday() == 2 // monday output mail "FOOBAR SCRIPT SUSPENDED" endif quit
or
begin =remind(..., "FOOBAR SCRIPT SUSPENDED") quit
For more examples, see Developer's Notes.