Page 1 of 1

Understanding service / host dependencies

Posted: Wed Jul 23, 2014 12:42 pm
by pastoolio
Hi Everyone

The problem:
- I have a few Linux machines (one of which for this example we will call empies) connecting to my server (called gaddafi) with OpenVPN.
- Because of this configuration, the reachability of empies is dependent on whether gaddafi itself is reachable or not. I mean, there is no way for the VPN to be connected if the VPN server itself is down.
- When you don't configure dependencies in nagios properly, when gaddafi goes down, I will also get notifications for empies (and the 30 odd other devices connecting to gaddafi via VPN). I would like to prevent that from happening by defining service dependencies for each VPN client to tell nagios that they are all dependent on gaddafi being up.

I have to following configuration for my nagios that doesn't work. It still sends out notifcations for both Ping services for each host if I filter all icmp packets to empies.

Code: Select all

define host{
        use                     generic-host
        host_name               empies
        check_command           check-host-alive
        address                 10.8[I].x.x[/I]
        max_check_attempts      3
        check_interval          1
        retry_interval          1
        parents                 gaddafi
}

define hostdependency{
        host_name                       empies
        dependent_host_name             gaddafi
        notification_failure_criteria   d,u
}



define service {
        use                     generic-service
        host_name               empies
        service_description     Ping
        check_command           check_ping!700.0,20%!1200.0,60%
}

define servicedependency{
        host_name                       empies
        service_description             Ping
        dependent_host_name             gaddafi
        dependent_service_description   Ping
        notification_failure_criteria   c
}
From the documentation as I understand it, when the service Ping on gaddafi is in a c (critical) state, then it should not send out notifications for the service Ping on empies, but it definitely does. Can someone please show me an example of how this should be done?

Re: Understanding service / host dependencies

Posted: Thu Jul 24, 2014 10:18 am
by lmiltchev
I may be wrong, but it looks like you need to swap the host_name with dependent_host_name... Instead of this:

Code: Select all

define hostdependency{
        host_name                       empies
        dependent_host_name             gaddafi
        notification_failure_criteria   d,u
}
you should have this:

Code: Select all

define hostdependency{
        host_name                       gaddafi
        dependent_host_name             empies
        notification_failure_criteria   d,u
}
Hostdependency - host name

This directive is used to identify the short name(s) of the host(s) that is being depended upon (also referred to as the master host). Multiple hosts should be separated by commas.

Parameter name: host_name
Hostdependency - dependent host name

This directive is used to identify the short name(s) of the dependent host(s). Multiple hosts should be separated by commas

Parameter name: dependent_host_name