Host and Services Dependency Question


#1

Hello, I’m very new to Nagios. I’m on a co-op term at a company in the IT dept and I’m trying to work on a small project to help clean up Nagios alerts on the network. One of the major tasks is to add in notification dependencies. This seems easy enough and im just editing the configs right now and nothing has been tested yet.

I notice in the documentation that you can have Host -> Host dependence and Service -> Service dependence but can you have Service -> Host dependence? For example if you have 2 PC’s behind a router on a site and you are testing all three hosts (the router and the 2 PCS) but also FTP/TELNET on the PC’s; can you configure Nagios so that both the PC hosts and services are dependent on just the router host. So that if the router goes down that we don’t get notifications from the PC hosts and the services running on them at the same time.


#2

check the “parents” directive in the docs :wink:

nagios.sourceforge.net/docs/3_0/ … .html#host


#3

[quote=“luca”]check the “parents” directive in the docs :wink:

nagios.sourceforge.net/docs/3_0/ … .html#host[/quote]

I don’t think this is what I need. I need to know if you can make service dependencies rely on hosts or if they can only rely on other services.

nagios.sourceforge.net/docs/3_0/ … ncies.html


#4

If a parent host is down, the “child” hosts get marked as unreachable and are NOT checked anymore, and so are their services.
So i’d say that yes, the “parents” directive is what you are looking for, at least staying to what i can understand from your first request.


#5

[quote=“luca”]If a parent host is down, the “child” hosts get marked as unreachable and are NOT checked anymore, and so are their services.
So i’d say that yes, the “parents” directive is what you are looking for, at least staying to what i can understand from your first request.[/quote]

Yes this is correct, we were looking to add this stuff in to eliminate unwanted alerts. So I didn’t think the parent directive was going to offer that solution but you can add in the option to not alert on unreachable. That being said, Nagios does alert unreachable by default.

[quote]UNREACHABLE States and Notifications
By default, Nagios will notify contacts about both DOWN and UNREACHABLE host states. As an
admin/tech, you might not want to get notifications about hosts that are UNREACHABLE. You know
your network structure, and if Nagios notifies you that your router/firewall is down, you know that
everything behind it is unreachable.
If you want to spare yourself from a flood of UNREACHABLE notifications during network outages,
you can exclude the unreachable (u) option from the notification_options directive in your host definitions
and/or the host_notification_options directive in your contact definitions.
192[/quote]


#6

Ah yes, sorry.

I usually disable that function as first thing :slight_smile:

If a router goes down i don’t want to be alerted for each and every host of that network being unreachable, and i suppose you don’t want that either.


#7

So I’m running into the same issue as before, Making hosts not alert is easy but I’m trying to make it so the services don’t alert as well. Were trying to use the dependency way and not the parent way right now. Back to my original question, can you make a service dependent on a host and not another service?


#8

if the host is unreachable, the service should not be checked, how can it send notifications?


#9

Ok maybe I have been mislead as to how that works. We just have basic monitoring turned on for hosts but also some services on those hosts. So if the host is down then Nagios by default wont alert to the services being down as well? I was under the impression that if we had the host go down that both the host and the services on that host will alert, which is annoying.


#10

AFAIK it shouldn’t, and it did not until a couple of releases ago. stil reinstalling my own server and i don’t have a configured nagios to make some tests…


#11

I’m experiencing the same “problem” using Nagios ver 3.2.1. (see also the screenshot attached).
I am not sure if the behavior was different in previous versions.

I consider this to be a problem, as I cannot see any logic in testing services on a host that is down or unreachable (and notifying about those)!
To manually add service-to-host dependencies as a workaround is too cumbersome (and wildcards are not quite helpful for my setup as not all services are the same on all hosts).

Is this a configuration error or should this be submitted as a bug for this version?Or was it always so (enhancement request)?

Thanks!
V.


#12

I’m runnning 3.2.1 and just tested this same behaviour and had NO problems.

I confiugured 4 services on my laptop (ping, http and two NSC tests) plugged it off the network and ONLY got a single notification about the host being down, i haven’t gotten a single service DOWN/UP notification.

So i’d say it’s a config problem.


#13

Would it be possible to upload a tar of your example conf files? I guess I would need to see the host, services, contact, dependency, escalation and their templates (if applicable).

Or maybe somebody knows the exact place where this behavior is determined?

thanks,
V.


#14

i really haven’t changed much from the default files… i use the standard templates changing only a bit of timing (no need for a check every 5 minutes on most of my stuff) and i disable notifications for unreachable hosts. That’s more or less it…

I tried copying my nagios.cfg here but it timeouts, not that there’s anything particular to be seen… i really tend to use quite straightforward options as long as i don’t have a particular need to get away from the default…


#15

Ok, my first impression was wrong: indeed Nagios does not NOTIFY about services on a host that is down, but it does CHECK them and thus we end up with many services in a PROBLEM state (critical, warning or unknown according to the checks command’s logic).

A more intuitive reaction (imho) would be to either set the services in an UNKNOWN state (…) or even better to refrain from checking services on a host which is down/unreachable (in latter case the service state is preserved and the statistics in the dashboard are more realistic; the last-check-time reveals that service check has been checked prior to host going down/unreachable.)

I guess the way to do this would be by explicitly creating “same host dependencies” (nagios.sourceforge.net/docs/3_0/ … dependency), but in a configuration similar to mine with many different hosts having a different set of services, it would result in a configuration which is very hard to maintain and doesn’t scale well.

Any recommendations from real-life (large) deployments?

regards,
V.


#16

[quote=“sanity”]I guess the way to do this would be by explicitly creating “same host dependencies” (nagios.sourceforge.net/docs/3_0/ … dependency), but in a configuration similar to mine with many different hosts having a different set of services, it would result in a configuration which is very hard to maintain and doesn’t scale well.

Any recommendations from real-life (large) deployments? [/quote]

Sorry to revive such an old thread – but I’m having similar issues in a large deployment.

Is the proper way to do this using “same host dependencies”? Does anyone have any examples of this?