Page 1 of 1

Programming Nagios Dependancies

Posted: Fri Sep 23, 2011 2:42 pm
by mdpc
I have read a few sources of Nagios documentation, and am still confused about the establishment of dependancies.

Q1: If a host is "down", will the notification for the services listed under the down host still be done?
Q2: How do I make a service dependent on a host being up/down. I see lots of examples for inter-service dependancy but do not see this particular case.
Q3: Do I have to define a host/service dependancy record for each and every service I need to have a dependancy, or can a dependancy record list several hosts and services to which it is dependant?

I only ask these questions because I have several thousand service points and several hundred hosts. And based on the some of the examples I have see, it looks like it could be a chore.

Thanks

Re: Programming Nagios Dependancies

Posted: Sun Sep 25, 2011 10:03 pm
by jsmurphy
Dependencies is one of the things that Nagios handles really well in my experience, to answer your questions directly:

Q1. No services will only alert if the host is alive.
Q2. If this is related to question 1. it's not necessary... if however you have a service on one host that checks another host and does not rely on a service check on that host then your best bet is ensuring that it returns an Unknown state rather than a Critical state if it can't retrieve that data and not alerting for Unknowns.
Q3. Personally I avoid service dependencies whenever possible and use the parent/child structure to control alert hierarchy... service dependencies are mostly useful for distributed application monitoring.

Focus on the host level first, then worry about the service level later is probably the most important advice I can give for your on-going sanity in large deployments.

Re: Programming Nagios Dependancies

Posted: Mon Sep 26, 2011 12:20 pm
by mdpc
Ok....but what about a service(s) being dependent on a host? Do I have to provide a dependancy record for each service? Can this be done? I see lots of examples of service-service dependancies but not a service-host situation.

Also, how would you go about configuration of a parent/child relationship? I thought that dependancy records were the only way to do this.

I'm still a little confused here. Some examples probably would help unconfuse me as well.

Thanks.

Re: Programming Nagios Dependancies

Posted: Mon Sep 26, 2011 6:17 pm
by jsmurphy
To answer your question directly: No, you can't make a service directly dependent on a host being alive (to my knowledge)... with that said I can't think of a situation where you would directly need to do this that can't be solved more easily using other means.

Alright for some examples:

define host {
use generic-host
host_name host1
}

define host {
use generic-host
host_name host2
parent host1
}

define service {
use generic-service
host_name host2
service_description test
check_command check_ping!100.0,60%!200.0,80%
}

If host2 is up and service test is down it will alert for the service.
If host2 goes down, host2 will alert and service test will not alert.
If host1 goes down, there will be an alert from host1 but there will be no alert from host2 or service test.

You can set up this style of chaining with service groups and host groups as well. I personally have no host dependencies defined any where and very few service dependencies in a relatively large set up.

This helps to explain parenting in more in depth and perhaps a little better: http://community.nagios.org/2009/08/23/ ... -required/