Monit is used for tracking service availability and taking action when services are detected to have failed. One action it takes is sending an email. Of course, you can configure the options of the message sent, the subject, and the apparant sender. Now, the manual for monit isn’t quite correct on this it seems. I copied the manual sectino for mail-format syntax into my monitrc file, only to have monit fail and tell me there was a syntax error on the mail-format!

It seems the problem is that mail-format may not use line breaks without having a command. The manual has a format similar to the following, there there is a break between the opening bracket and the first command:

set mail-format {
    from: monit@my.host.com
    subject: $SERVICE $EVENT at $DATE
    message: Monit $ACTION $SERVICE at $DATE on $HOST,
        $DESCRIPTION

    Yours sincerely,
     Monit @ $HOST
}

This fails on a syntax error. Removing the line break like this:

set mail-format { from: monit@my.host.com
    subject: $SERVICE $EVENT at $DATE
    message: Monit $ACTION $SERVICE at $DATE on $HOST,
        $DESCRIPTION

    Yours sincerely,
     Monit @ $HOST
}

Makes it work (tah-dah!).

On a another note, I think this blog has had too many technical articles of late. I’ll try to post something not related to computers soon!

Written on January 21st, 2009 , Informative

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

SirSpanky.com – The Secret Diary of James Pearce Aged 20-Something is proudly powered by WordPress and the Theme Adventure by Eric Schwarz
Entries (RSS) and Comments (RSS).

SirSpanky.com – The Secret Diary of James Pearce Aged 20-Something

Personal jorunal of a professional geek – James Pearce in Perth, Australia