[Top][All Lists]

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

Re: Mailformat question

From: Martin Pala
Subject: Re: Mailformat question
Date: Mon, 28 Mar 2005 22:15:16 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.6) Gecko/20050324 Debian/1.7.6-1

The new-line problem is caused in this mail handling code:

    do_send(&S, "%s\r\n", m->message);
    if(m->opt_message) {
      do_send(&S, "%s\r\n", m->opt_message);

The optional event description (opt_message) is independent of mail-format string and it is included after the mail-format message on new line.

The result of the following mail-format message option:

set mail-format { message: $EVENT $SERVICE at $DATE on $HOST }

is for example:

Data access error vfatfs at Mon, 28 Mar 2005 21:52:33 +0200 on unicorn
'vfatfs' unable to read device /dev/hda6 state

... as you can see, the first line corresponds to the format string, but the second line is extra one (not specified in format string).

We can maybe fix it by consolidation of message and opt_message data ... by introduction of new event description token (for example $EVENT_DESCRIPTION) and using it instead of explicit inclusion (it will be needed to change default message format template ALERT_MESSAGE in alert.h too). You one-line message format which will include event description will then look for example like this:


$ACTION token in mail-format is supported since monit-4.3, i have tested
it on current cvs version (upcomming monit-4.5) ... it works well. You may maybe want to try monit-4.5 beta ( and test it.


Christian Schoepplein wrote:

On Sa, Mär 26, 2005 at 08:19:57 +0100, Martin Pala wrote:

You can use custom message format - see monit manual:

Thanks for this link, but I've changed the default mailformat already. It looks like this:

set mail-format {
  from: address@hidden
  subject: $SERVICE $EVENT at $DATE
  message: $EVENT $SERVICE at $DATE on $HOST

But that doesn't solve my problem :-(.

Christian Schoepplein wrote:


mail2sms gateway. The mail2sms service seems to ignore new lines in a message, it looks like \n is not working correctly. Example: I recived a warning on a failed connection test per mail and sms. The mail looks like this:

Connection test failed foo.tld at Fri, 25 Mar 2005 05:29:48 +0100 on bar.tld Event: 'foo.tld' failed, cannot open a connection to INET[]

The question is, what causes the last line in the example above:

Event: 'foo.tld' failed, cannot open a connection to

I think this can't be triggered via the mail-format settings. This line is insertet with a line break in the alert and this line break and the following text is ignored by the mail2sms gateway. So the sms looks like this:

Connection test failed foo.tld at Fri, 25 Mar 2005 05:29:48 +0100 on

The line with the event gets lost :-(. I have to avoid line breaks in the alerts, that would solve the problem. Or BTW.: The $ACTION variable doesn't work with my monit version too :-(. It causes a syntax error. Is this a known problem and is it fixed in newer releases?

reply via email to

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