Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

In my company there are two redundant MX servers, I would like to tell nagios to wake me in the night ONLY if both servers are down.
The default behavior is to alert whenever one of the MX servers is down. I would like to set a timeperiod i.e. 23:00 to 06:00 when nagios only alerts me by sms in case both servers are down.
I am using nagios3 but I couldn't find something like this in the docs.
Solution:
I've used this check_command in a service called MXservice:

check_command check_service_cluster!"MXservice"!2!1!$SERVICESTATEID:mx1:SMTP$,$SERVICESTATEID:mx1:SMTP$

Thanks for all your help

share|improve this question

4 Answers 4

up vote 4 down vote accepted

Nagios used to have a check_cluster plugin which would only alert if all servers in a given cluster were down, for example. I never used it myself but quite a few people did on the mailing lists.

I believe it's still in 3.0 - have a look at this page.

share|improve this answer
    
It's weird I didn't think of it, I am already using the cluster to check for the dsl service (to look for major problems). I think it will be the way through. .- MX1 and MX2 will have no individual alerts by night .- MXcluster will have night alerts when more than one mx is failing –  Aseques Mar 18 '10 at 13:37

Nagios has host and service dependency configuration files. I've linked the documentation below. You can cross-link the checks and each will only alert if the other is down.

Nagios Dependencies

share|improve this answer
    
I already had looked at dependencies, but it's a bit overhead for my case. Thanks for you comments BTW –  Aseques Mar 18 '10 at 13:38
    
The problem with dependencies is that they trigger if either of the dependencies fail. What we want with redundant services is for it to only trigger if both services failed. –  sjbotha Dec 27 '11 at 21:11

In addition to what's been said. You can use timeperiods to have nagios alter it's behavior in event alerts and escalations depending on the time period. That link explains how time periods work with contacts, escalations, and dependencies.

Using this in combination with the check that Andy mentioned you could have it run a normal service/host check during business hours to send you alerts for any outage of any server during business hours. Then in after business hours it can switch over to using the cluster check and only alert you when all the MX servers are down.

EDIT: After re-reading your question it appears as this is what you intend to do.

share|improve this answer

What about an end-to-end check? I have two checks: one that makes sure my mailserver can send to gmail, and another that it can receive. Verifies all sorts of goodies it must transverse in one bang.

share|improve this answer
    
This would be another possibilty, but in that case you are relaying totally on gmail. The can ban your IP for flooding them with messages, or for some reason the can fall down too. I had a check similar to this some time ago, but sometimes the deliveries were delayed, and could trigger false alarms. –  Aseques Apr 3 '10 at 15:31
    
I ran into that issue, just needed to spread out the check interval to every 10 minutes (instead of every 3) and you can (should) add another mailserver, aside from google, to give you 2 solid points of ref. If you want to know that mail is flowing, this is the best way to do it. also could wrapper a check that goes crit only when both servers don't ping... –  meesterfox Apr 7 '10 at 17:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.