hostgroups and service dependencies?

Andreas Ericsson ae at op5.se
Fri May 22 11:49:55 CEST 2009


Frost, Mark {PBG} wrote:
> I'm just starting to get into service dependencies.  My problem is that
> I don't quite see how I can get around doing it individually for each
> and every service and host needed.
> 
> An example is if I've got 100 Windows servers all configured to be part
> of a hostgroup.  Then I've got a 
> 
> 
> 		define service {
> 		        hostgroup_name
> prod_windows_servers
> 		        service_description             NRPE Service
> 		        check_command                   NRPE Service
> 		        use                             Production
> Windows Service
> 		}
> 
> 		define service {
> 		        hostgroup_name
> prod_windows_servers
> 		        service_description             CPU Load
> 		        check_command
> check_windows_load!90%!90%
> 		        use                             Production
> Windows Service
> 		}
> 
> 		define service {
> 		        hostgroup_name
> prod_windows_servers
> 		        service_description             C: Drive
> 		        check_command
> check_windows_disk!C:!90%!90%
> 		        use                             Production
> Windows Service
> 		}
> 
> where the 100 servers are all part of the 'prod_windows_servers"
> hostgroup.  Here I can list the checks nice and compactly and add new
> hosts/checks merely by putting them in that hostgroup.
> 
> I would like to make service checks on these boxes dependent on the
> "NRPE Service" check above.  So if the NRPE service was not responding,
> Nagios wouldn't bother sending me alerts about all the other things on
> that box it could not reach.
> 
> The object definitions seem to say that I can do
> 
> 		define servicedependency {
> 		        hostgroup_name
> prod_windows_servers
> 		        service_description             NRPE Service
> 		        dependent_hostgroup_name
> prod_windows_servers
> 		        dependent_service_description   C: Drive
> 		        execution_failure_criteria      n
> 		        notification_failure_criteria   w,u,c
> 		}
> 
> I'm assuming that this is supposed to match up each
> 'prod_windows_servers' entry with its matching entry rather than making
> each server dependent on this servers from *every* other hostgroup
> member?
> 

You assume wrong. This makes it depend on each hostgroup member. In order
to do "same-host" dependencies, you can leave out one of the "hostgroup_name"
or "dependent_hostgroup_name". I can't remember which, so go browse the docs
to find out. Do note that same-host dependencies only work in Nagios 3.

> Just to see, I tried this out and when I did a pre-flight check it took
> 53 seconds (checking the host and service dependencies) when it normally
> runs instantly.
> 

Right. I'll try to apply the depth first search to host and service
dependencies too. It was originally a patch from Jean Gabès, and it
speeds up parent/child relations for hosts by a *huge* amount, so it's
probably worth adding it to dependencies too.

Even so, I'm guessing you actually added 100 (or more) times the number of
dependencies you expected to add, so it's not surprising this eats a lot
of CPU.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Register now for Nordic Meet on Nagios, June 3-4 in Stockholm
 http://nordicmeetonnagios.op5.org/

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com 
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list