Page 1 of 1

Nagios Unable to Send Email After SMTP Migration

Posted: Fri May 31, 2019 10:46 am
by JNelson
We recently replaced our SMTP server. We're using a virtual host, so the hostname in use did not change, so there should be no settings to update. A wide variety of servers and devices across our global environment experienced no impact or disruption of service, but only Nagios is experiencing an issue.

I get the following when attempting a test email:

"A test email was sent to [email protected]
----
Mailer said: [05-31-2019 11:28:33] SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/ ... leshooting (method=smtp;host=usmlvrelay.vsp.com;port=25;security=none), Referer: admin/testemail.php
An error occurred sending a test email!"

I am able to send an email manually using telnet from the Nagios server, so there does not appear to be any connectivity issues. I ran RHEL updates and rebooted the server. I'm struggling to find an error more detailed than "SMTP connect() failed". Any advice for how to proceed?

Re: Nagios Unable to Send Email After SMTP Migration

Posted: Fri May 31, 2019 12:49 pm
by cdienger
Enable debug logging by following https://support.nagios.com/kb/article/p ... g-820.html and let us know what is returned.

Re: Nagios Unable to Send Email After SMTP Migration

Posted: Fri May 31, 2019 1:00 pm
by JNelson
Thanks for your reply. Here are the results after changing the debug level.

Code: Select all

2019-05-31 17:57:20	Connection: opening to usmlvrelay.vsp.com:25, timeout=300, options=array ( ) 2019-05-31 17:57:20	Connection: opened 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "" 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "220 mailr7.vsp.com Microsoft ESMTP MAIL Service, Version: 10.0.14393.2608 ready at Fri, 31 May 2019 13:57:20 -0400 " 2019-05-31 17:57:20	SERVER -> CLIENT: 220 mailr7.vsp.com Microsoft ESMTP MAIL Service, Version: 10.0.14393.2608 ready at Fri, 31 May 2019 13:57:20 -0400 2019-05-31 17:57:20	CLIENT -> SERVER: EHLO usmlvnagios01.vsp.com 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "" 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-mailr7.vsp.com Hello [10.44.12.104] " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-TURN " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-SIZE 104857600 " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-ETRN " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-PIPELINING " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-DSN " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-ENHANCEDSTATUSCODES " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-8bitmime " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-BINARYMIME " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-CHUNKING " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-VRFY " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-TLS " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-TLS " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250-STARTTLS " 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-TLS 250-STARTTLS " 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "250 OK " 2019-05-31 17:57:20	SERVER -> CLIENT: 250-mailr7.vsp.com Hello [10.44.12.104] 250-TURN 250-SIZE 104857600 250-ETRN 250-PIPELINING 250-DSN 250-ENHANCEDSTATUSCODES 250-8bitmime 250-BINARYMIME 250-CHUNKING 250-VRFY 250-TLS 250-STARTTLS 250 OK 2019-05-31 17:57:20	CLIENT -> SERVER: STARTTLS 2019-05-31 17:57:20	SMTP -> get_lines(): $data is "" 2019-05-31 17:57:20	SMTP -> get_lines(): $str is "220 2.0.0 SMTP server ready " 2019-05-31 17:57:20	SERVER -> CLIENT: 220 2.0.0 SMTP server ready 2019-05-31 17:57:20	SMTP Error: Could not connect to SMTP host. 2019-05-31 17:57:20	SMTP NOTICE: EOF caught while checking if connected 2019-05-31 17:57:20	Connection: closed 2019-05-31 17:57:20	SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

Re: Nagios Unable to Send Email After SMTP Migration

Posted: Fri May 31, 2019 1:41 pm
by cdienger
The XI system is trying to do TLS even though "none" is selected for security and the mail server is likely not expecting the STARTTLS command XI is sending. To stop this, edit /usr/local/nagiosxi/html/includes/phpmailer/class.phpmailer.php and change line 260 from:

Code: Select all

public $SMTPAutoTLS = true;
to:

Code: Select all

public $SMTPAutoTLS = false;

Re: Nagios Unable to Send Email After SMTP Migration

Posted: Fri May 31, 2019 2:06 pm
by JNelson
That resolved the issue. Thanks so much for your quick and accurate support!

Re: Nagios Unable to Send Email After SMTP Migration

Posted: Fri May 31, 2019 2:18 pm
by cdienger
Glad to hear! I will be filing a bug regarding this. Thanks for bringing it to our attention.