On Thu, Nov 03, 2005 at 01:44:21PM -0500, Bill wrote:
[about including environment variables in the alert subject]

[...]
> > In this case, the monitor script won't work properly without MIBDIRS
> > defined.  You can use this feature to pass environment vars into your
> > script, so the same alert script could take different actions or send
> > different messages based on the contents of an environment var.
> 
> Yeah, I was hoping that there was already someway to do it without
> creating another alert program - I loath re-inventing the wheel so to
> speak.  But have no problem doing so if it has not been done.  

I have something like it on my site in our locally modified copy of
mail.alert:

   $desc= $ENV{'MON_DESCRIPTION'} || "";

   [...]

        $ALERT= "ALERT";
        $t= localtime($failtime);
        $downmsg= "Down for $downtime seconds";
        $downmsg .= "\n\nNotes: $desc\n" if length($desc);

In this case, I'm using the "description" field in the mon config,
which is also viewable in the GUI.  I use this field for suggestions
on what to do if the service goes down, which helps a lot when someone
less familar with the system has to handle an alarm at 3 AM.

Anyway, this is just straightforward scripting, nothing to be afraid of.

If anyone wants, I'll post our mail.alert.  It has a bunch of fixes in
it for Mon 1.1 compatibility (for new alert types like ackalerts),
which should be available soon from a CVS repository near you....

_______________________________________________
mon mailing list
mon@linux.kernel.org
http://linux.kernel.org/mailman/listinfo/mon

Reply via email to