Monit

在 monit 中指定郵件伺服器主機名和 tlsv1

  • January 5, 2012

$$ Edit: I answered the first half of my issue, so I’ll edit this to address the second half. $$ /etc/monit/monitrc 看起來像這樣:

set mailserver
   smtp.server.net
   port 587
   username "USERNAME"
   password "PASSWORD"
   using tlsv1 with timeout 30 seconds
   using hostname "server.fqdn.com",

   smtp.server2.net
   port 587
   username "USERNAME"
   password "PASSWORD"
   using tlsv1 with timeout 30 seconds
   using hostname "server.fqdn.com"

sudo service monit syntax吐出這個:

/etc/monit/monitrc:57: Error: syntax error 'smtp.server2.com'

起初我有錯誤的使用/使用這樣的語法:

   using tlsv1
   using hostname "server.fqdn.com"
   with timeout 30 seconds

典型的,在發布後,我立即找到了答案。

with timeout 30 seconds部分屬於using tlsv1,所以語法是這樣的:

正確的配置原來是這樣的:

set mailserver
   smtp.server.net
   port 587
   username "USERNAME"
   password "PASSWORD"
   using tlsv1
   ,
   smtp.gmail.com
   port 587
   username "USERNAME"
   password "PASSWORD"
   using tlsv1

   with timeout 30 seconds
   using hostname "server.fqdn.com"

和聲明出現在所有伺服器都被列出之後with timeoutusing hostname它們適用於列表中的所有郵件伺服器。我花了很長時間才最終弄清楚這一點,但如果你仔細觀察,它就在手冊中。白色間距是可選的。

引用自:https://serverfault.com/questions/346574