[PATCH] Fix to allow incomplete service dependency templates

Jason Hoos jhoos at thwack.net
Tue Dec 12 06:28:37 CET 2006


Ethan Galstad wrote:
> Gaspar, Carson wrote:
>   
>>> -----Original Message-----
>>> From: nagios-devel-bounces at lists.sourceforge.net 
>>> [mailto:nagios-devel-bounces at lists.sourceforge.net] On Behalf 
>>> Of Ethan Galstad
>>> Sent: Monday, December 11, 2006 3:05 PM
>>> To: Nagios-Devel
>>> Subject: Re: [Nagios-devel] [PATCH] Fix to allow incomplete 
>>> service dependency templates
>>>
>>> Jason Hoos wrote:
>>>       
>>>> Since it's not a registered object, the servicedependency template 
>>>> should be valid, but Nagios reports "Could not expand dependent 
>>>> hostgroups and/or hosts specified in service dependency" instead.
>>>>
>>>>         
>>> Actually, I think this should result in an error message, even 
>>> though the template dependency isn't going to be registered.  
>>> Better to catch a problem earlier, rather than later when the 
>>> template is being used.
>>>       
>> I violently disagree. Templates are, by definition, semantically
>> incomplete. Why is this config line any more or less vital than every
>> other missing config line? By your logic, templates shouldn't exist at
>> all.
>>
>>     
>
> You are partially correct.  Templates are usually incomplete, but they 
> should not contain incorrect data.  In your example the template 
> references a hostgroup, which in turn has a bad membership list (one 
> host does not exist).
>
>
> Ethan Galstad,
> Nagios Developer
> ---
> Email: nagios at nagios.org
> Website: http://www.nagios.org
>   
I apologize for the slightly bad example, in that it led things in the 
wrong direction.  For sake of argument, say that host "b" does exist.  
Even if all prerequisites (hosts a and b, the generic-host template, 
etc.) are properly defined, this snippet will *still* give you an error, 
even though there shouldn't be anything wrong with the servicedependency 
template.  The underlying problem is that the code skips validation on 
host and service dependencies only if all of hostgroup_name, host_name, 
dependent_hostgroup_name, and dependent_host_name are null.  The patch 
changes the logic so that the validations are skipped if either 
hostgroup_name and host_name are null, or dependent_hostgroup_name and 
dependent_host_name are null.  In other words, if you either haven't 
specified any source information, or you haven't specified any dependent 
information, then it skips the check; without the patch you have to not 
specify all of it before it'll realize it's dealing with a partial template.

Hopefully that explains things better...

Thanks,
Jason


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV




More information about the Developers mailing list