[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do you set different e-mail subjects per alert?
From: |
Callum Macdonald |
Subject: |
Re: How do you set different e-mail subjects per alert? |
Date: |
Tue, 21 Aug 2012 10:05:10 +0100 |
There's an error in your configuration.
The format is not if test then alert address@hidden, the alert statement is
global to the whole check. So the correct format is:
if test then alert
if test2 then alert
alert address@hidden
In your specific case, that translates into an extra "alert" keyword
like so:
check file import.lastrun with path /var/lib/import.lastrun
if timestamp > 28 hours then alert
alert address@hidden with mail-format { subject: "XYZ import error" }
Or it might be simpler to understand if you look at it this way:
check file import.lastrun with path /var/lib/import.lastrun
alert address@hidden with mail-format { subject: "XYZ import error" }
if timestamp > 28 hours then alert
Tested on Monit version 5.3.2. :-)
Cheers - Callum.
On Tue, 2012-08-21 at 13:07 +1000, Adam Nielsen wrote:
> Hi all,
>
> I have a bunch of tests which do somewhat cryptic things (like checking
> timestamps of log files), so because a check failure doesn't immediately
> explain what the problem is I would like to include a more descriptive
> message in the e-mail subject of the alert.
>
> Looking at the Monit documentation, I should be able to do something
> like this:
>
> check file import.lastrun with path /var/lib/import.lastrun
> if timestamp > 28 hours then
> alert address@hidden with mail-format { subject: "XYZ import error" }
>
> Unfortunately this gives me the following error:
>
> /etc/monit/monitrc:3: Error: syntax error 'address@hidden'
>
> I'm not sure why it's rejecting the e-mail address, as that's the way
> the command is listed in the documentation. I don't really want to
> specify the e-mail address anyway, as I want all alerts to go to the
> same place, as specified by the "set alert" command.
>
> So if I leave the address off, hoping it will use the default, I then
> get this error:
>
> /etc/monit/monitrc:3: Error: syntax error 'mail-format'
>
> I'm a bit confused as I can't see what I am doing differently to the
> examples in the docs.
>
> Can anyone advise how to change the e-mail subject for specific alert
> messages?
>
> Many thanks,
> Adam.
>
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general