Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup Monit with Amazon SES

I'm having a hard time setting up my monitrc file. I'm using Capistrano to setup Monit on Amazon EC2, using this tutorial as a guide:

http://railscasts.com/episodes/375-monit

set daemon 30

set logfile /home/deployer/apps/example/shared/log/monit.log
set idfile /var/lib/monit/id
set statefile /var/lib/monit/state

set eventqueue
    basedir /var/lib/monit/events
    slots 100

set mailserver email-smtp.us-east-1.amazonaws.com port 587
   username "amazon_username" password "amazon_password"
   using TLSV1
   with timeout 30 seconds

set alert [email protected]

set httpd port 2812
    allow admin: "admin_password"

check system example_server
  if loadavg(5min) > 2 for 2 cycles then alert
  if memory > 95% for 2 cycles then alert
  if cpu(user) > 75% for 2 cycles then alert

include /etc/monit/conf.d/*

Looking at my logs, I'm getting the following error:

Sendmail error: 554 Message rejected: Email address is not verified.

I've tried other things like changing the port to 465, but with similar results.

After googling around, I found this post:

http://syshen.cc/post/14394727394/node-js-upstart-monit-and-aws-ses

It describes how to set up the sender:

To specify the sender by just “set mail {from: [email protected]}”.

But this syntax is nowhere to be found in the Monit documentation.

Any help would greatly be appreciated. Been pulling my hair out on this for a while.

like image 886
JPN Avatar asked Mar 30 '14 15:03

JPN


1 Answers

In monit you need setup the MAIL-FORMAT directive:

As per the documentation:

SET MAIL-FORMAT {mail-format}
Example:

 set mail-format {
      from: [email protected]
  reply-to: [email protected]
   subject: $SERVICE $EVENT at $DATE
   message: Monit $ACTION $SERVICE at $DATE on $HOST: $DESCRIPTION.
            Yours sincerely,
            monit
 }

The from field has to match the email that you are allowing in SES.

like image 179
Rico Avatar answered Oct 18 '22 07:10

Rico