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!