sSMTP : Cannot open smtp.gmail.com:587

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
W.W.
Posts: 17
Joined: Wed Apr 05, 2017 3:18 am

sSMTP : Cannot open smtp.gmail.com:587

Post by W.W. »

Hi,

I try to set up ssmtp to send the notificatins of nagios by email but I have the below error

Code: Select all

May 17 14:43:10 VM004 sSMTP[31783]: Unable to connect to "smtp.gmail.com" port 587.
May 17 14:43:10 VM004 sSMTP[31783]: Cannot open smtp.gmail.com:587
ssmtp.conf

Code: Select all

# Your email address
root=SSSS@gmail.com

# Your Username | your password
AuthUser=SSSS@gmail.com
AuthPass=MyPassWord
AuthMethod=LOGIN

# Address and port number to send mail to
mailhub=smtp.gmail.com:587

# So the message appears to come from FAI | Hostname
#RewriteDomain=
#Hostname=
FromLineOverride=YES

# TLS | SSL/TLS Certificate
UseTLS=YES
UseSTARTTLS=YES
#UseTLSCert=YES

# RSA certificate.
#TLSCert=/etc/pki/tls/private/ssmtp.pem
#TLSCert=/etc/pki/tls/certs/ca-bundle.crt
revaliases

Code: Select all

root:SSSS@gmail.com:smtp.gmail.com:587
nagios:SSSS@gmail.com:smtp.gmail.com:587
commands.cfg

Code: Select all

# 'notify-host-by-email' command definition
define command{
	command_name	notify-host-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/sbin/sendmail.ssmtp -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
	}
#/usr/sbin/sendmail.postfix sudo -s

# 'notify-service-by-email' command definition
define command{
	command_name	notify-service-by-email
	command_line	/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n $NOTIFICATIONCOMMENT$\n" | /usr/sbin/sendmail.ssmtp -s  "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
I have a centos 6.9 who run nagios core 4.1
thanks
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: sSMTP : Cannot open smtp.gmail.com:587

Post by dwhitfield »

This is not really a Nagios issue. You'll likely get a quicker resolution on the CentOS forums.

That said, https://www.digitalocean.com/community/ ... mtp-server suggests you are using the wrong port #.
Locked