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

I have two following passive services: ServiceA, ServiceB on one machine.

I would like to have a sittuation when the OK state is satisfied by following conditions:

  • ServiceA is OK or ServiceB is OK
  • ServiceA is OK and SericeB is OK

I would like to have alarm when:

  • ServiceA is down and Service B is down

What configuration option should I use to implement that? Servicedependency looks good but I had no luck with that one.

share|improve this question

4 Answers 4

up vote 4 down vote accepted

check_cluster is the "old school" way to do it, as mentioned already. But it's kludgy at best.

check_multi is a much better option for this; it is designed for exactly what you want.

share|improve this answer
    
This looks great. –  wojciechz Nov 15 '13 at 17:31
1  
Very cool, looks like this is actually in the debian repos too: apt-get install nagios-plugin-check-multi –  Cory J Nov 15 '13 at 20:22

This is known as monitoring a "cluster" of services. You can use the check_cluster script.

The documented method uses a wrapper script like this instead of calling it directly:

define command{

command_name    check_service_cluster

command_line    /usr/local/nagios/libexec/check_cluster --service -l $ARG1$ -w $ARG2$ -c $ARG3$ -d $ARG4$ 

}

and then defining your own specific service:

define service{

...

check_command   check_service_cluster!"DNS Cluster"!1!2!$SERVICESTATEID:host1:dnsservicename,$SERVICESTATEID:host2:dnsservicename,$SERVICESTATEID:host3:dnsservicename

...

}

In this example 1/3 services not OK is a warning, 2/3 services not OK is a critical.

Nagios Docs

More explanation in Groundworks knowledge base

share|improve this answer
    
This looks OK if you have 2 identical services. What about monitoring 2 services that are having different command_lines? –  wojciechz Nov 14 '13 at 21:12

One of the ways to achieve that is using servicedependency with "failing" on "OK state" like following:

define servicedependency{
 host_name                       hostX
 service_description             ServiceA
 dependent_host_name             hostX
 dependent_service_description   ServiceB
 execution_failure_criteria      o
 notification_failure_criteria   o
 }

"o" in "execution_failure_criteria" means that if ServiceA is in OK state, it won't check for ServiceB. It won't also notify if ServiceB has state "other than OK" (it won't be checked anyway)

This is ALMOST a perfect solution. There are still two minor problems:

  • this works only for two services (however you can use "dependent_hostgroup_name" which will make the service dependency work on many hosts)
  • once ServiceB is marked as failed,uknown,warning,whatever, it will remain in this state because it's not checked due to "o" (OK state of ServiceA)
share|improve this answer

As said earlier, check_multi is a solution (the best if you don't want to see at all that only one of the service is down)

Another one is to use Nagios BPI: http://assets.nagios.com/downloads/nagioscore/docs/Using_The_BPI_Addon.pdf

With that addon you can build complex "business" indicators, such as: everything is OK if just one of my web servers is OK AND just one of my database servers is OK

Another option like Nagios BPI is Check_MK BI (but you certainly need to switch to Check_MK, which is a great product, to use it): http://mathias-kettner.de/checkmk_bi.html

share|improve this answer

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.