Setting up Dependencies for Nagios

I’m trying to setup dependencies for a router and several servers. What I want to do is setup the router as the Master Host so if the router fails all other services on the servers won’t alert.

Unfortunately this is easier said than done. Is there an easy way to setup service dependencies for all services on a server for a Master Host (or my router)?

Nagios has some documentation but it will be extremely time consuming to add a single service dependency definition for every service.

http://nagios.sourceforge.net/docs/3_0/objectdefinitions.html#servicedependency

Best Answer

What you want in this case is not dependencies (as Nagios calls them), but rather you want parent/child relationships in your hosts. If the parent is down and children can not be reached Nagios considers them “unreachable” instead of “down”. You can then configure not to be notified if things are “unreachable”. You can read more about this in the Nagios documentation here.

Also, from the same section of the 2.0 documentation it is pointed out that services won’t alert if the host is down (saving you those alerts):

Whenever a service check results in a
non-OK status level, Nagios will
attempt to check and see if the host
that the service is running on is
“alive”. Typically this is done by
pinging the host and seeing if any
response is received. If the host
check command returns a non-OK state,
Nagios assumes that there is a problem
with the host. In this situation
Nagios will “silence” all potential
alerts for services running on the
host and just notify the appropriate
contacts that the host is down or
unreachable. If the host check command
returns an OK state, Nagios will
recognize that the host is alive and
will send out an alert for the service
that is misbehaving.

Service dependencies by default are not inheritable from a host template, but I believe the parent is. So you can inherit parents from templates (if I am correct in this) and save yourself some typing.

Lastly, I actually like to have unreachable alerts enabled. If the router goes down, I want my phone to go “nuts”. 🙂

You may Also Like:

Leave a Comment