简体   繁体   English

如何使用Amazon SES设置Monit

[英]How to setup Monit with Amazon SES

I'm having a hard time setting up my monitrc file. 我很难设置我的monitrc文件。 I'm using Capistrano to setup Monit on Amazon EC2, using this tutorial as a guide: 我正在使用Capistrano在Amazon EC2上设置Monit,使用本教程作为指南:

http://railscasts.com/episodes/375-monit 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 alerts@example.com

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. Sendmail错误:554邮件被拒绝:未验证电子邮件地址。

I've tried other things like changing the port to 465, but with similar results. 我尝试过其他一些事情,例如将端口更改为465,但结果相似。

After googling around, I found this post: 谷歌搜索后,我发现这篇文章:

http://syshen.cc/post/14394727394/node-js-upstart-monit-and-aws-ses 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: your-name@example.com}”. 仅通过“设置邮件{from:your-name@example.com}”指定发件人。

But this syntax is nowhere to be found in the Monit documentation. 但是在Monit文档中找不到这种语法。

Any help would greatly be appreciated. 任何帮助将不胜感激。 Been pulling my hair out on this for a while. 我已经把头发拉了一会儿。

In monit you need setup the MAIL-FORMAT directive: 在monit中,您需要设置MAIL-FORMAT指令:

As per the documentation : 根据文件

SET MAIL-FORMAT {mail-format}
Example:

 set mail-format {
      from: monit@foo.bar
  reply-to: support@domain.com
   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. from字段必须与您在SES中允许的电子邮件相匹配。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM