[1.1.36] Cacti mailer throwing SMTP connect() failed error

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
namruf15
Posts: 6
Joined: Fri Jun 23, 2017 5:14 am

[1.1.36] Cacti mailer throwing SMTP connect() failed error

Post by namruf15 »

Expected behavior
Cacti should be able to send e-mails to users

Current behavior
Cacti is throwing an error:
Sending Email Failed. Error was SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting
Such message is visible in two situations:
  • when testing email is launched from settings page,
  • when thold plugin is trying to send an email about host unavailability
Details
As I described above I'm not receiving any emails because the SMTP connect() error. Host on which Cacti resides have all needed access and firewalls opened. The thing is that emails were working earlier and to be honest - I don't know what happened that they stopped. This can be some issue related to my environment but I have no idea what error this can be.

I tried to launch script from viewtopic.php?p=272027#p272027 and it is working properly (I receive an email).

Technical information
Date Tue, 18 Sep 2018 08:08:48 +0200
Cacti Version 1.1.36
Cacti OS unix
RSA Fingerprint db:e2:75:65:d2:27:93:5b:d9:7e:ff:dd:78:b2:44:7b
NET-SNMP Version NET-SNMP version: 5.7.2.1
RRDtool Version RRDtool 1.4.x
Devices 46
Graphs 264
Data Sources Script/Command: 5
SNMP Get: 302
SNMP Query: 165
Script Query: 2
Script Query - Script Server: 1
Total: 475
Poller Information
Interval 60
Type SPINE 1.1.36 Copyright 2004-2017 by The Cacti Group
Items Action[0]: 631
Action[1]: 9
Action[2]: 2
Total: 642
Concurrent Processes 5
Max Threads 20
PHP Servers 10
Script Timeout 25
Max OID 50
Last Run Statistics Time:3.5428 Method:spine Processes:5 Threads:20 Hosts:46 HostsPerProcess:10 DataSources:133 RRDsProcessed:60
System Memory
MemTotal 8.00 K MB
MemFree 6.59 K MB
Buffers 295.12 MB
Cached 463.95 MB
Active 1.02 K MB
Inactive 217.41 MB
SwapTotal 3.81 K MB
SwapFree 3.81 K MB
PHP Information
PHP Version 5.6.33-0+deb8u1
PHP OS Linux
PHP uname Linux ta-026 3.16.0-5-amd64 #1 SMP Debian 3.16.51-3+deb8u1 (2018-01-08) x86_64
PHP SNMP Not Installed
max_execution_time 30
memory_limit 128M
Output from test_mail.php (I replaced fragile addresses with X-es):
Checking Configuration...Method: SMTP
Ping Results: Success
Sending Message...2018-09-18 06:11:07 Connection: opening to xxxxxxxxxxxxxxxxxxx:25, timeout=10, options=array (
)
2018-09-18 06:11:07 Connection: opened
2018-09-18 06:11:07 SERVER -> CLIENT: 220 xxxxxxxxxxxxxxxxxxxxx ESMTP Sendmail Mailhost Secure; Tue, 18 Sep 2018 09:11:07 +0300
2018-09-18 06:11:07 CLIENT -> SERVER: EHLO ta-026
2018-09-18 06:11:08 SERVER -> CLIENT: 250-xxxxxxxxxxxxxxxxxxxxx Hello [10.42.35.187], pleased to meet you
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-8BITMIME
250-SIZE 36700160
250-DSN
250-ETRN
250-STARTTLS
250-DELIVERBY
250 HELP
2018-09-18 06:11:08 CLIENT -> SERVER: MAIL FROM:<xxxxxxxx@xx.com>
2018-09-18 06:11:08 SERVER -> CLIENT: 250 2.1.0 <xxxxxxxx@xx.com>... Sender ok
2018-09-18 06:11:08 CLIENT -> SERVER: RCPT TO:<xxxxxxxx@xx.com>
2018-09-18 06:11:08 SERVER -> CLIENT: 250 2.1.5 <xxxxxxxx@xx.com>... Recipient ok
2018-09-18 06:11:08 CLIENT -> SERVER: DATA
2018-09-18 06:11:08 SERVER -> CLIENT: 354 Enter mail, end with "." on a line by itself
2018-09-18 06:11:08 CLIENT -> SERVER: Date: Tue, 18 Sep 2018 08:11:07 +0200
2018-09-18 06:11:08 CLIENT -> SERVER: To: xxxxxxxx@xx.com
2018-09-18 06:11:08 CLIENT -> SERVER: From: hran-cacti <xxxxxxxx@xx.com>
2018-09-18 06:11:08 CLIENT -> SERVER: Subject:
2018-09-18 06:11:08 CLIENT -> SERVER: Message-ID: <deb61b7308a8166e3a620e17a4b49b6b@ta-026>
2018-09-18 06:11:08 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.26 (https://github.com/PHPMailer/PHPMailer)
2018-09-18 06:11:08 CLIENT -> SERVER: MIME-Version: 1.0
2018-09-18 06:11:08 CLIENT -> SERVER: Content-Type: multipart/alternative;
2018-09-18 06:11:08 CLIENT -> SERVER: boundary="b1_deb61b7308a8166e3a620e17a4b49b6b"
2018-09-18 06:11:08 CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: This is a multi-part message in MIME format.
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: --b1_deb61b7308a8166e3a620e17a4b49b6b
2018-09-18 06:11:08 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: This is a test message generated from Cacti. This message was sent to test the configuration of your Mail Settings
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: Your email settings are currently set as follows
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: Method: SMTP
2018-09-18 06:11:08 CLIENT -> SERVER: Device: xxxxxxxxxxxxxxxxxxxxx
2018-09-18 06:11:08 CLIENT -> SERVER: Port: 25
2018-09-18 06:11:08 CLIENT -> SERVER: Authentication: false
2018-09-18 06:11:08 CLIENT -> SERVER: Ping Results: Success
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: --b1_deb61b7308a8166e3a620e17a4b49b6b
2018-09-18 06:11:08 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: This is a test message generated from Cacti. This message was sent to test the configuration of your Mail Settings<br><br>Your email settings are currently set as follows<br><br><b>Method</b>: SMTP<br><b>Device</b>: xxxxxxxxxxxxxxxxxxxxx<br><b>Port</b>: 25<br><b>Authentication</b>: false<br><b>Ping Results</b>: Success<br><br><br>
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: --b1_deb61b7308a8166e3a620e17a4b49b6b--
2018-09-18 06:11:08 CLIENT -> SERVER:
2018-09-18 06:11:08 CLIENT -> SERVER: .
2018-09-18 06:11:08 SERVER -> CLIENT: 250 2.0.0 w8I6B7Es000715 Message accepted for delivery
2018-09-18 06:11:08 CLIENT -> SERVER: QUIT
2018-09-18 06:11:08 SERVER -> CLIENT: 221 2.0.0 xxxxxxxxxxxxxxxxxxxxx closing connection
2018-09-18 06:11:08 Connection: closed

Result: Success!
Settings page
In attachement
Attachments
Cacti settings page
Cacti settings page
cacti_mail_settings.JPG (108.86 KiB) Viewed 1222 times
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: [1.1.36] Cacti mailer throwing SMTP connect() failed err

Post by netniV »

This is most likely an SELinux thing because the webserver is attempting to make an outgoing network connection. If you have SELinux enable, you may have to either add a rule to permit this or disable SELinux.
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: [1.1.36] Cacti mailer throwing SMTP connect() failed err

Post by netniV »

In fact, as I went to see if we could add a message to warn about this being enabled, I found the specific setting that would block direct network connections:
httpd_can_network_connect
try running

Code: Select all

 
getenforce
getsebool httpd_can_network_connect
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
namruf15
Posts: 6
Joined: Fri Jun 23, 2017 5:14 am

Re: [1.1.36] Cacti mailer throwing SMTP connect() failed err

Post by namruf15 »

Nope it is not working.
ute@ta-026:~$ sudo getsebool httpd_can_network_connect
getsebool: SELinux is disabled
netniV
Cacti Guru User
Posts: 3441
Joined: Sun Aug 27, 2017 12:05 am

Re: [1.1.36] Cacti mailer throwing SMTP connect() failed err

Post by netniV »

Is the debug output the same when using the web-based test and the console one?
Cacti Developer & Release Manager
The Cacti Group

Director
BV IT Solutions Ltd

+--------------------------------------------------------------------------+

Cacti Resources:
Cacti Website (including releases)
Cacti Issues
Cacti Development Releases
Cacti Development Documentation
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests