Servicedependency issue, bug or PEBCAK


#1

I’m running Nagios v2.9 on a linux (2.4 kernel) and running into the following situation:
(I have searched the forum and googled this, and only found others with the same problem. No solutions.)

The following servicedependency ‘should’ be functional based on the Template tricks doc.

define servicedependency{ host_name master service_description PORT2000 dependent_host_name proxy-here,proxy-there,proxy-everywhere dependent_servicegroup_name proxy-2000 notification_failure_criteria w,u,c }

When I verify the configuration changes, I get the following error:

Error: NULL service description/host name in service dependency definition Error: Could not register service notification dependency (config file '/usr/local/nagios/etc/dependencies.cfg', starting on line 100)

Any input as to my mistake(s) would be most appreciated. Even if you tell me that this is fixed in 3.x…

If this configuration was to make real sense, I wouldn’t have to define the dependent_host_name list as the membership in proxy-2000 should be sufficient.

Thanks,
erik


#2

Hm, haven’t seen this error ever.
Are you sure you’re using the service_description variable, not the service_name in dependency definition?


#3

I’m not exactly sure what you are asking. I posted my servicedependency and the important section of my service config is as follows:

define service{ use generic-service host_name master service_description PORT2000

I based my config on the following entry from the Template tricks doc linked in my earlier message and quoted below:

that shows others with the same problem (and no solutions that I can see).

(working in the dependencies.cfg)
If I comment the host_name, I get the following:

If I comment the service_description (or leave it uncommented) I get:

Error: NULL service description/host name in service dependency definition Error: Could not register service notification dependency

It looks to me as if nagios is expecting a primary service group for every dependent one.

I’ve also tried the following (from the template tricks which really looks like it expects one primary for each dependent) to no avail:

[quote]All Services In Multiple Servicegroups: If you want to create service dependencies for all services that belong in one or more servicegroups, you can do use the servicegroup_name and/or dependent_servicegroup_name directive as follows:

define servicedependency{ servicegroup_name SERVICEGROUP1,SERVICEGROUP2,...,SERVICEGROUPN dependent_servicegroup_name SERVICEGROUP3,SERVICEGROUP4,...SERVICEGROUPN other escalation directives ... }[/quote]


#4

A-ha, think I have found where the problem is. You can’t make one service dependent on several hosts and a servicegroup (as it isn’t said anywhere in template tricks). For a servicegroup to be defined as dependent you can only make it depend on the other servicegroup (again, as said in template tricks). The possible solutions are that you make dependency for each of your proxy-xxx hosts, for your example you could do something like this:

define servicedependency{ host_name master service_description PORT2000 dependent_host_name proxy-here,proxy-there,proxy-everywhere dependent_service_description proxy-2000-service1 notification_failure_criteria w,u,c } define servicedependency{ host_name master service_description PORT2000 dependent_host_name proxy-here,proxy-there,proxy-everywhere dependent_service_description proxy-2000-service2 notification_failure_criteria w,u,c }
etc.

Hope I’ve understood it well this time and that this helps. Try it and inform us on the result. :slight_smile: