3

I've got monit running on a server to alert by email with the following config

set mailserver 127.0.0.1
 using hostname "vps1.sender.com"

set mail-format { from: monit@sender.com }

set alert webmaster@receiver.com

but the mails are still coming through with a hostname of localhost

 Aug  7 08:40:55 mx1 postfix/smtpd[31060]: NOQUEUE: reject: RCPT from
 vps1.sender.com[xx.xx.xx.xx]: 504 5.5.2 <localhost>: Helo command
 rejected: need fully-qualified hostname; from=<monit@sender.com>
 to=<webmaster@receiver.com> proto=ESMTP helo=<localhost>

It's the only config file I have.

What am I missing?

Christian
  • 746
  • 3
  • 13
  • 30

3 Answers3

2

In monitrc edit/add the line:

check system vps1.sender.com

and vps1.sender.com will be shown as the host on the email

giantas
  • 121
  • 4
1

Monit uses /etc/hostname and /etc/hosts files for fqdn. If you did not setup those files, hostname file includes localhost line by default. You must change this to your fqdn and set yourIP fqdn in /etc/hosts file.

Sencer H.
  • 532
  • 1
  • 8
  • 17
  • Both are set to vps1.sender.com – Christian Aug 07 '13 at 09:18
  • Does you subdomain registered in any DNS server? Or just named in server hosts file? – Sencer H. Aug 07 '13 at 09:21
  • Maybe we both looking wrong place! What if problem caused by mail service? While I read second time it dawned on me. `` is printed in `mail log`. I think you must check your mail service configuration. – Sencer H. Aug 07 '13 at 09:37
  • I KNOW WHAT IT IS!! In postfix main.cf, it had `myhostname=localhost` how annoying! Thanks for your time though. – Christian Aug 07 '13 at 09:38
1

The problem was a configuration issue with postfix.

Make sure the myhostname= variable is set correctly in /etc/postfix/main.cf. Apparently monit cant override that setting.

Christian
  • 746
  • 3
  • 13
  • 30