Nginx Upstream – Notification That Primary Servers Are Down

load-balancenginx

I am hoping someone can give me some help, as I am pretty new to Nginx. Thanks in advance.

Premise:
I have a load balancing server (nginx upstream) in a test environment, load balancing between two web servers. I use the fail_timeout parameter because, if one server goes down, I cannot have it re-introduced until I have manually intervened, due to data integrity issues between the two.

Issue:
I need to know that the server in question has been taken out of the loop. Email might be asking too much, but any event I can trigger would be very helpful.

Note:
Whilst I have systems monitoring the servers, which should notify me if one goes down, it is more important that I know when the Nginx 'thinks' a server is down, in case the load balancing server cannot contact a given server, whilst the monitoring systems can, for whatever reason that might be.

Best Answer

Sounds like an ideal situation for monit, specifically the notifications feature. If the Nginx log spits out "server down" or some such, monit can email you or, better yet, email to your cell phone's text number registering an SMS message, or an email to Pagerduty to trigger it to call you. You call on how much noise you want it to make ;)

  • edit: was working on collectd while writing this. My bad; monit's the way to go here!
Related Topic