Page 1 of 1

Failover SMTP server

Posted: Wed Aug 13, 2014 8:19 am
by belvdr
I have two separate standalone SMTP servers in two different locations.

During maintenance or downtime of the primary SMTP server, I'd like Nagios to use the secondary SMTP server.

Does Nagios support a secondary SMTP server setting? If not, does anyone have a script they use to test SMTP server connectivity first before sending a notification?

Re: Failover SMTP server

Posted: Wed Aug 13, 2014 9:11 am
by tmcdonald
Nagios does not support a secondary SMTP server at this time.

I found one related post but nothing the discusses detecting the SMTP availability first:

http://support.nagios.com/forum/viewtop ... 14&p=15425

It can certainly be done, but it would slow down every notification since you now have to check even if the server is in a known good state.

Re: Failover SMTP server

Posted: Wed Aug 13, 2014 9:55 am
by WillemDH
Or use some sort of load balancer like F5 or something if you are lucky to have one.

We have one and it is working fine. Email is sent to smtp alias pointing to F5 load balancer which will direct traffic to any alive smtp server.

Cheers

Willem

Re: Failover SMTP server

Posted: Wed Aug 13, 2014 4:17 pm
by abrist
Load balancer or virtual ip are the solutions I have seen used the most.

Re: Failover SMTP server

Posted: Wed Aug 13, 2014 4:20 pm
by tmcdonald
In a pinch you could do it with DNS, but the propagation time might be an issue and you would need to change this at the DNS level anyway, so may as well do it in XI.

Re: Failover SMTP server

Posted: Thu Aug 14, 2014 7:02 am
by belvdr
Thanks for the thoughts.

I'm looking into using pacemaker to deploy a postfix cluster, but that's taking some time to design. I was hoping for a simpler solution, but it seems it doesn't exist.

Re: Failover SMTP server

Posted: Thu Aug 14, 2014 2:26 pm
by tmcdonald
We can always enter in a feature request, since this seems like a pretty reasonable thing to need. Or if you need it now, custom development is always an option.

Do either of these appeal to you?

Re: Failover SMTP server

Posted: Thu Aug 14, 2014 4:32 pm
by belvdr
Feature request is fine. I believe a simple check to see if the email is sent would be enough. For example, if Nagios attempts to send an email through smtp1 and it fails or the connection isn't accepted, then it would rotate to the next SMTP server, and so forth.

I appreciate you accepting this input.

Re: Failover SMTP server

Posted: Thu Aug 14, 2014 5:02 pm
by abrist
Log your feature request at: tracker.nagios.com
The has not really been requested as most people control this with dns or virtual ips/clustering.