[Nagios-devel] Service dependencies broken in CVS HEAD?

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Service dependencies broken in CVS HEAD?

Post by Guest »

Hi there,

Yesterday I wanted to redo my patch for same-host service dependencies
and add a master switch in the main config file so that by default it
won't allow to omit the dependent_host*_name parameter.

I started by building a test config... I just couldn't manage to create
a service dependency. Even the simplest and straightforward
servicedependency definition just wouldn't work. To be on the safe side
I even checked one of my prod config with CVS HEAD after removing
same-host svc deps and making it v3-compatible with no luck either. It
would complain on every servicedependency definitions.

Looking at the code I couldn't really tell what was wrong as I do not
yet understand fully how Nagios parses the config.

Also worth noting is some code for same-host depedencies. It's so
incomplete I just can't understand how it got there!?!

$ nl xdata/xodtemplate.c|grep -iC3 same.host
3952 char *host_name=NULL;
3953 char *service_descriptions=NULL;
3954 int first_item=FALSE;
3955 int same_host_dependency=FALSE;
3956 #ifdef NSCORE
3957 char *temp_buffer=NULL;
3958 #endif
--
4365 /****** PROCESS SERVICE DEPENDENCY DEPENDENT
HOSTS/HOSTGROUPS/SERVICES *****/
4366
for(temp_servicedependency=xodtemplate_servicedependency_list;temp_servicedependency!=NULL;temp_servicedependency=temp_servicedependency->next){

4367 /* ADDED 02/04/2007 - special case for "same
host" dependencies */
4368
if(temp_servicedependency->dependent_host_name==NULL &&
temp_servicedependency->dependent_hostgroup_name==NULL){
4369 if(temp_servicedependency->host_name)
4370
temp_servicedependency->dependent_host_name=(char
*)strdup(temp_servicedependency->host_name);

As you can see there's a boolean for same host deps that isn't used
(should be set to TRUE where it duplicates host_name to
dependent_host_name and also used later to avoid most duplications to
occur. Also hostgroup_name ist't duplicated so I think it wouldn't work
with hostgroup_name.

Thanks,

Thomas





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
Locked