Ad Widget

Collapse

Sendmail: connection refused - No mails sent

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bill gates
    Junior Member
    • Jun 2012
    • 4

    #1

    Sendmail: connection refused - No mails sent

    Hello,

    I'm not receiving emails notifications. I added 2 media types:
    - Email
    - Jabber

    Jabber is working fine. In Email, I tried using various settings:

    SMTP server: server1 and server1.example.com
    ("uname" -n shows me "server 1" and when I login to telnet port 25, the answer is "220 server1.runnerace.com ESMTP Sendmail 8.14.4/8.14.4/Debian-2ubuntu1; Tue, 5 Jun 2012 22:21:51 +0400; (No UCE/UBE) logging access from: localhost(OK)-localhost [127.0.0.1]")

    Helo: I tried using localhost and 127.0.0.1

    I configured users and actions.

    If I stop apache2 , I receive a Jabber message. But no Email notification.

    The event details shows:
    Cannot connect to SMTP server [server1.example.com] [*** Cannot connect to [server1.example.com]:25 [Connection refused]]

    I can send emails using telnet.

    I added "sendmail: 127.0.0.1" in /etc/hosts.allow

    tail /var/log/mail.log shows a lot of this messages "Jun 5 22:28:31 server1 sm-mta[13529]: q55ISVl7013529: localhost [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA-v4"
    This messages keep coming, also when no events are triggered.


    I'm running:
    - Zabbix 1.8.3
    - Linux server1 2.6.18-274.7.1.el5.028stab095.1 #1 SMP Mon Oct 24 20:49:24 MSD 2011 x86_64 x86_64 x86_64 GNU/Linux
    - DISTRIB_DESCRIPTION="Ubuntu 11.04" (I tried also using Debian 5 and 6 and ubuntu 10.04 )
    - Sendmail 8.14.4/8.14.4/Debian-2ubuntu1

    If anyone could help, I would appreciate that.

    Thanks!
  • clementine
    Junior Member
    • May 2012
    • 13

    #2
    Originally posted by bill gates
    /var/log/mail.log shows a lot of this messages "Jun 5 22:28:31 server1 sm-mta[13529]: q55ISVl7013529: localhost [127.0.0.1] did not issue MAIL/EXPN/VRFY/ETRN during connection to MTA-v4"
    This messages keep coming, also when no events are triggered.
    Chances are great these are side effect of Zabbix simple checks on server1 for smtp service, ie. simple tcp connect on porrt 25. sendmail expects some RFC compliant MUA to introduce itself using HELO or EHLO. It gets none of them, it is logged.

    I am new to zabbix but, in order to get better diagnostic in you mail.log, I suggest that you disable the simple check for smtp which creates noise. Make some event to trigger notification message and try to see with tail -f what goes on the sendmail side.

    Also check zabbix_server.log (I don't know if something useful about SMTP is put with default debug level).

    Also check sendmail access table, localhost should be RELAY or OK, name resolution, usual suspects, etc...

    Hope this helps.

    Comment

    • bill gates
      Junior Member
      • Jun 2012
      • 4

      #3
      Thanks Clementine,

      I disabled checks on SMTP server, I stopped receiving new messages on /var/mail.log but nothing new appeared after stopping apache.

      I checked sendmail access and found "localhost RELAY"

      I put zabbix on debug mode, but found no new logs on zabbix server logs.

      I keep receiving jabber alerts after stopping apache, but no email notification. ( Cannot connect to SMTP server [server] [*** Cannot connect to [server]:25 [Connection refused]])

      What can be happening?

      Thanks

      Comment

      • clementine
        Junior Member
        • May 2012
        • 13

        #4
        Hmmm, this is weird...

        If you have no log in sendmail it looks like zabbix can't establish the smtp session.

        In your original post, you provided the following log:

        Cannot connect to SMTP server [server1.example.com] [*** Cannot connect to [server1.example.com]:25 [Connection refused]]

        and now it is

        Cannot connect to SMTP server [server] [*** Cannot connect to [server]:25 [Connection refused]]

        Are you sure that zabbix can resolve the host name ?
        How is your email media setup ?

        Those questions may sound dumb but sometimes it happens we miss the right point and go south

        Comment

        • bill gates
          Junior Member
          • Jun 2012
          • 4

          #5
          Thanks Clementine,

          I have created 2 media types, one using "server1.example.com" and the other "example.com" as SMTP server, for testing purposes, to see wich one works, but none of them works.

          Today, I added another media type using "localhost" as SMTP server. It also doesn't work; I receive the same error Cannot connect to SMTP server - Connection refused, and no logs.

          I checked the file /etc/mail/local-host-names and found only localhost. I added 2 lines with example.com and server1.example.com and tested again with the same error.

          I own the domain "example.com" but I didn't pointed it to this server. I'm just using the IP address of the server. Does this has something to do? "uname" -n shows me "server 1". When I login to telnet port 25, the answer is "220 server1.runnerace.com

          Any advice? How can I check if zabbix can resolve the hostname?

          Thanks,

          Federico
          Last edited by bill gates; 08-06-2012, 20:08.

          Comment

          • clementine
            Junior Member
            • May 2012
            • 13

            #6
            Originally posted by bill gates
            I checked the file /etc/mail/local-host-names and found only localhost. I added 2 lines with example.com and server1.example.com and tested again with the same error.
            They have nothing to do with TCP session establishment problems. This file may contain host aliases for domains when acting as a central mail hub.

            According to what you report, zabbix can't open a tcp connection on localhost port 25. I see two possible reasons for that:
            1) sendmail doesn't listen on port 25 on the loopback interface but port 587 (MSA)
            2) there is some tcp wrapper or firewall which doesn't grant the connection and does RST provoking.

            => I would check the socket table

            Any advice? How can I check if zabbix can resolve the hostname?
            Check with nslookup, check nsswitch, check resolv.conf.
            If this is ok, perform a full stop of zabbix daemons in the same shell session, then start it and check.

            What is puzzling here is that the error message tells that the TCP session can't be established like if the destination socket was closed while you tell you can telnet to it. This looks really weird to me.

            "uname" -n shows me "server 1"
            using *nix for decades, I never had a hostname with a blank character. This is an easy way to break scripts during macro substitution and expressions evaluations.
            Last edited by clementine; 08-06-2012, 20:42. Reason: typo

            Comment

            • bill gates
              Junior Member
              • Jun 2012
              • 4

              #7
              Thanks,

              I'll just reinstall the OS and try again. This is out of my knowledge.

              This time I will try using CentOS and install Zabbix using yum. I though I was missing something "easy", because I tried using 3 different OSs (Debian 5 and 6, and Ubuntu 10.4) and got the same error.

              It's a VPS dedicated to Zabbix.

              I appreciate your help Clementine. I'll report back and tell you if I can get it to work or not.

              Comment

              Working...