Hello,
I configured SSMTP to send emails, from the terminal I'm not having problems but sending email alerts for Nagios is not working.
I attach you the 2 commands that I have for send emails on commands.cfg
# '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/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
}
# '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" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $CONTACTEMAIL$
}
This what I have from \var/log/mail.log
Jun 19 23:14:52 sdnagios01 sSMTP[2117]: Creating SSL connection to host
Jun 19 23:14:52 sdnagios01 sSMTP[2117]: SSL connection using RSA_AES_128_CBC_SHA1
Jun 19 23:14:55 sdnagios01 sSMTP[2117]: Sent mail for root@sdnagios01 (221 2.0.0 closing connection k36-v6sm1278389wrc.20 - gsmtp) uid=0 username=root outbytes=541
Jun 19 23:15:15 sdnagios01 sSMTP[2129]: Creating SSL connection to host
Jun 19 23:15:15 sdnagios01 sSMTP[2129]: SSL connection using RSA_AES_128_CBC_SHA1
Jun 19 23:15:17 sdnagios01 sSMTP[2129]: Sent mail for root@sdnagios01 (221 2.0.0 closing connection n7-v6sm711134wrr.39 - gsmtp) uid=0 username=root outbytes=541
On contacts.cfg I have the following
define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit default values from generic-contact template (defined above)
alias Nagios Admin ; Full name of user
email myemail@gmail.com ; <<***** CHANGE THIS TO YOUR EMAIL ADDRESS ******
}
I don't know whatelse to check, any idea?
Thanks in advance for helping me
Best regards
Can't get email notifications with SSMTP
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Can't get email notifications with SSMTP
How did you configure you mail sending program?
What OS is this? What mail program is this?
You are sending mail as root@sdnagios01 which is likely not going to be accepted from remote SMTP server as there is no route back because the domain is invalid
What OS is this? What mail program is this?
You are sending mail as root@sdnagios01 which is likely not going to be accepted from remote SMTP server as there is no route back because the domain is invalid
Re: Can't get email notifications with SSMTP
Hello, finally I got this working.
Many thanks for the reply!!
Many thanks for the reply!!
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Can't get email notifications with SSMTP
Glad to hear its working
Locking
Locking