Monit connects to the MAILSERVER even when there are no messages to send.

Issue #410 closed
Allon Hadaya created an issue

System: Ubuntu: 16.04 Monit: 5.16 Postfix: 3.1.0

I'm using Postfix as an MTA for alerts coming from Monit with:

SET MAILSERVER 127.0.0.1

It seems that Monit decides to connect and disconnect from postfix every time it runs checks. This isn't an outright bug, just a weird behaviour. It means that my /var/log/mail.log contains a lot of lines letting me know (every minute) someone connected and immediately disconnected. It adds noise to the logs, making it harder to see the important lines.

Jul  5 15:35:03 gator postfix/smtpd[23529]: connect from localhost[127.0.0.1]
Jul  5 15:35:03 gator postfix/smtpd[23529]: disconnect from localhost[127.0.0.1] ehlo=1 quit=1 commands=2

It would be nice to have Monit only connect when there's something to send.

I'm still unfamiliar with the code at the moment. Do you think this would be an easy+worthwhile change to make? Would anyone be willing to guide me in making this kind of contribution? What files should I read to understand how to write the change?

Comments (2)

  1. Tildeslash repo owner

    Monit connects to the mailserver only when an alert is to be delivered - the connect is most probably caused by standalone port test for postfix, for example:

    check process postfix ...
        if failed port 25 protocol smtp then alert
    
  2. Log in to comment