问题原文
原帖链接 · Jiechao Li · CC BY-SA 3.0
I am trying to use monit, and set up email server using gmail. The configuration file is like this:
set mailserver smtp.gmail.com port 587
username "[email omitted]" password "password"
using tlsv1
with timeout 30 seconds
And I set an alert to test:
check file alerttest with path /.nonexistent
alert [email omitted] with reminder on 500 cycles
But when I use monit validate, the error message I got is this:
Sendmail: error receiving data from the mailserver 'smtp.gmail.com' -- Resource temporarily unavailable
Alert handler failed, retry scheduled for next cycle
'alerttest' file doesn't exist
Sendmail: error receiving data from the mailserver 'smtp.gmail.com' -- Resource temporarily unavailable
'alerttest' trying to restart
Anyone has any ideas? Thanks a lot
社区高分解答
原帖链接 · David Okwii · CC BY-SA 4.0
You can use a remote mail server. Here are my sample configs which worked. It sends alerts to my gmail through a remote smtp server. I think you still use Gmail as an smtp relay as well.
#configure remote smtp server in monitrc
/etc/monit/monitrc
set mailserver mail.yourmailserver.com port 587
username "[email omitted]" password "mypassword"
using tlsv1
with timeout 30 seconds
#set the from email which should be same as the one above
set mail-format { from: [email omitted] }
//
/etc/monit/conf.d/monit.services
monitor apache2
check process apache with pidfile /var/run/apache2/apache2.pid
alert [email omitted] only on { timeout,nonexist,resource,pid,connection }
start program = "/etc/init.d/apache2 start" with timeout 60 seconds
stop program = "/etc/init.d/apache2 stop"
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
