I'm brand new to Monit, trying to set it up on my CentOS7 VPS. I put the following settings in monitrc
:
set mailserver 127.0.0.1
set alert me@externaldomain.org
But the email fails, and the entry in maillog
is bizarre:
Feb 26 10:47:23 puphpet2 postfix/smtp[11673]: 8B66C18D8: to=<monit@puphpet2.thisdomain.com>, relay=none, delay=2.2, delays=0/0.01/2.1/0, dsn=5.4.4, status=bounced (Host or domain name not found. Name service error for name=puphpet2.thisdomain.com type=AAAA: Host not found)
Of course such a host would not be found - puphpet2
is just my VPS's hostname, not a subdomain. And there is no monit
user, let alone a mailbox. What in the world is Monit trying to do?
I tried set mailserver mail.thisdomain.com
, but I got the same log entry.
If I go local (set alert me@thisdomain.com
), it works - here is the series of log entries:
Feb 26 11:24:33 puphpet2 postfix/smtpd[13965]: connect from localhost[127.0.0.1]
Feb 26 11:24:33 puphpet2 postfix/smtpd[13965]: 65443879: client=localhost[127.0.0.1]
Feb 26 11:24:33 puphpet2 postfix/cleanup[13968]: 65443879: message-id=<1519611873.159354611@puphpet2>
Feb 26 11:24:33 puphpet2 postfix/qmgr[14340]: 65443879: from=<monit@puphpet2.thisdomain.com>, size=669, nrcpt=1 (queue active)
Feb 26 11:24:33 puphpet2 postfix/smtpd[13965]: disconnect from localhost[127.0.0.1]
Feb 26 11:24:33 puphpet2 postfix/local[13969]: 65443879: to=<me@thisdomain.com>, relay=local, delay=0.09, delays=0.05/0.02/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Feb 26 11:24:33 puphpet2 postfix/qmgr[14340]: 65443879: removed
monit@puphpet2.thisdomain.com
is a weird sender address, but at least the email gets delivered. But isn't it smarter to send alerts outside the server?