monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about scripting


From: Callum Macdonald
Subject: Re: Question about scripting
Date: Wed, 24 Jul 2013 12:54:18 +0200

You can use the first 255 chars of the output on an exec test if it fails, but 
that probably won't offer you enough customisation in this case.

The downside is that you're now reliant on your script being able to 
successfully send email AND monit being able to send email, so you potentially 
have two copies of your SMTP credentials, etc.

For example, I use monit to monitor mysql replication lag with the exec 
feature. The script I've written exits with an error if the delay is above a 
threshold, and writes the delay to stderr, that way I get a regular monit email 
which contains the number of seconds behind master, and I get a matching 
SUCCEEDED email once the issue has sorted itself out.

Cheers - Callum.

On 24 Jul 2013, at 12:50, Thorsten Kampe <address@hidden> wrote:

> * Callum Macdonald (Wed, 24 Jul 2013 12:30:43 +0200)
> 
>> I'd suggest the simplest approach is probably to use `if failed then exec 
>> script` and `if succeeded then exec script`, where the two scripts send the 
>> email and then copy the file.
> 
> You're probably right. I couldn't see any option to attach files to an 
> alert email or to modify the body with output from an external command.
> 
> Thorsten
> 
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

[Prev in Thread] Current Thread [Next in Thread]