Q: Is there a way to include some text into monit's alert message?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Q: Is there a way to include some text into monit's alert message?

Storm

Hi all! I have a simple question about using monit's program checks.

I plan to use program check, with it's exit code I can force monit to send alert mail message, ok. But how to include into that message some output produced by checking program?

I could modify program to write it's output in some file but how to tell monit to use this file during message composing?

There is something description field in mail-format, is it suitable for this purpose?

From monit's docs:

The subject and body may contain $NAME variables, which are expanded by Monit. Here is a list of variables that can be used when composing an alert message

$DESCRIPTION The description of the error condition


Thanks in advance for your answers!


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
Reply | Threaded
Open this post in threaded view
|

Re: Q: Is there a way to include some text into monit's alert message?

Bryan Harris
Unless I misunderstand your question, I do this by printing to standard output. Like in the script here:

https://bitbucket.org/tildeslash/monit/issues/346/check-user-account-expiration

On Thu, Apr 19, 2018 at 2:26 AM, Storm <[hidden email]> wrote:

Hi all! I have a simple question about using monit's program checks.

I plan to use program check, with it's exit code I can force monit to send alert mail message, ok. But how to include into that message some output produced by checking program?

I could modify program to write it's output in some file but how to tell monit to use this file during message composing?

There is something description field in mail-format, is it suitable for this purpose?

From monit's docs:

The subject and body may contain $NAME variables, which are expanded by Monit. Here is a list of variables that can be used when composing an alert message

$DESCRIPTION The description of the error condition


Thanks in advance for your answers!


--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general



--
So the HP guy comes up to me and he says, 'If you say nasty things like that to vendors you're not going to get anything'. I said 'no, in eight years of saying nothing, we've got nothing, and I'm going to start saying nasty things, in the hope that some of these vendors will start giving me money so I'll shut up'.

 -Theo De Raadt

--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general
Reply | Threaded
Open this post in threaded view
|

Re: Q: Is there a way to include some text into monit's alert message?

Szépe Viktor
Idézem/Quoting Bryan Harris <[hidden email]>:

> Unless I misunderstand your question, I do this by printing to standard
> output. Like in the script here:
>
> https://bitbucket.org/tildeslash/monit/issues/346/check-user-account-expiration
>
> On Thu, Apr 19, 2018 at 2:26 AM, Storm <[hidden email]> wrote:
>
>> Hi all! I have a simple question about using monit's program checks.
>>
>> I plan to use program check, with it's exit code I can force monit to send
>> alert mail message, ok. But how to include into that message some output
>> produced by checking program?
>>
>> I could modify program to write it's output in some file but how to tell
>> monit to use this file during message composing?
>>
>> There is something description field in mail-format, is it suitable for
>> this purpose?
>>
>> From monit's docs
>> <https://mmonit.com/monit/documentation/monit.html#Message-format>:
>>
>> The subject and body may contain $NAME variables, which are expanded by
>> Monit. Here is a list of variables that can be used when composing an alert
>> message
>>
>> …
>>
>> $DESCRIPTION The description of the error condition
>>
>>
>> Thanks in advance for your answers!

The very same program you use for exit status may produce output.
It is included in alert emails. It is "R:8.8.8.8 2"

  Status failed Service network_resolv

         Date:        Wed, 18 Apr 2018 05:01:42
         Action:      alert
         Host:        staging.example.com
         Description: status failed (1) -- R:8.8.8.8 2

Your faithful employee,
Monit



SZÉPE Viktor, honlap üzemeltetés / Running your application
https://github.com/szepeviktor/debian-server-tools/blob/master/CV.md
--
ügyelet/hotline: +36-20-4242498  [hidden email]  skype: szepe.viktor
Budapest, III. kerület






--
To unsubscribe:
https://lists.nongnu.org/mailman/listinfo/monit-general