Whenever I set up a new alarm, I like to receive mail alerts about its operation just to reassure me that it's doing its intended job. After a time, however, the verbose messages becoming tiring. It gets to be a nuisance hearing about routine "chmod'ed <this>" or "truncated <that>".
Case in point: I recently developed the NumberedSyslogFileNotice alarm, shown below.
/////////////////////////////////////////////////////////////////////////////// NumberedSyslogFileNotice init status active level notice task "To report existence of, and to dispose of, syslog.[0-9]* files" input proc "=ll =syslog\.[0-9]* 2> /dev/null" =lldata rule // only delete syslog files greater than five days old if #fileage($mon,$date,$time) > 5 output mail "deleting: $inline" #ifdef doexec exec wait "=rm -f $name" #elsedef output mail "=rm -f $name" #endifdef endif ///////////////////////////////////////////////////////////////////////////////
Having finally grown tired of seeing many such "deleting: ..." messages stuffing my mailbox, this morning I began to implement my usual fix of commenting out the "output mail" line:
// output mail "deleting: $inline"
Then I thought: No, there's a better way. Here's a new addition to my defines.cfg file:
verbose FALSE // if TRUE, output mail about routine execs, such as // "deleting <this>" or "truncating <that>"; usually // set this to FALSE; but occasionally set this to // TRUE to get a fuller report of all that PIKT is // doing silently, behind-the-scenes
Now, instead of commenting out reports of routine exec actions, I put an #ifdef wrapper around them instead:
#ifdef verbose output mail "deleting: $inline" #endifdef
I have revisited my alarms.cfg file and added a couple dozen such #ifdef's where before I had simply commented out.
Whenever I feel the need to do a full audit of everything that PIKT is doing, I will reinstall all files with the command:
# piktc -iv +D verbose ALL
After the audit--i.e., after reviewing the newly verbose messages for several days--I will put things back to normal with the command
# piktc -iv ALL
where the "-D verbose" is unnecessary because the verbose define is set to FALSE in defines.cfg by default.
The line between too much PIKT mail and just enough PIKT mail is a fine one. The "#ifdef verbose" trick makes it easier to achieve the proper balance.
Note that #ifdef verbose" is not the same as my "#ifdef stifle". I use
the latter to suppress nagmail about things I need to know about but
don't need to be reminded about constantly. Things like orphaned accounts,
which don't require immediate attention but which I don't want to forget
For more examples, see Developer's Notes.