I’m using haproxy 2.4.22 on Ubuntu Server 22.04 and I would like to have the server send an email alert when a backend server goes down.
Here is a portion of my /etc/haproxy/haproxy.cfg file :
mailers omm_relay
mailer smtp1 10.100.50.125:587
mailer smtp2 10.100.50.126:587
defaults
email-alert mailers omm_relay
email-alert from server@domain.com
email-alert to me@domain.com
email-alert level info
When I shut down a backend server, I see this in the haproxy.log file :
haproxy[7704]: [WARNING] (7704) : Server rabbitCluster_web/web1 is DOWN, reason: Layer4 timeout, check duration: 2001ms
Despite that I do not receive any email from the server.
I have installed postfix and mailutils and used them to confirm that the server can send email though those SMTP servers with no authentication.
I don’t see any record of haproxy trying to send email at all.
I’ve also tried putting the email-alert config lines in the backend section but that doesn’t work either.
Any ideas what might be wrong or how I can further diagnose this?
Thank you.