Re: [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

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

Post by Guest »

Thomas Guyot-Sionnest wrote:
> 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
>

You shouldn't need to apply your patch - I've already implemented
similar functionality in the CVS code. If you want same host
dependencies, don't use the "dependent_host_name",
"dependent_hostgroup", or "dependent_servicegroup" directives.

define servicedependency{
host h1,h2
service_description svc1
dependent_service_description svc2,svc3
}

I just posted an update to CVS with some code cleanups, but no change in
functionality. Should make it easier to understand the code in
duplicate_objects().


Ethan Galstad,
Nagios Developer
---
Email: [email protected]
Website: http://www.nagios.org





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