Notification period inheritance problem

Marc Powell marc at ena.com
Tue Dec 15 22:38:41 CET 2009


On Dec 15, 2009, at 2:04 PM, Gordon Messmer wrote:

> On 12/15/2009 10:49 AM, Marc Powell wrote:
>> 
>> No, in order to do that, the notification_period needs to be unspecified. null != unspecified. Because you're explicitly setting it to null, you break the implied inheritance.
>> 
>> To take advantage of the implied inheritance, you need to leave out the directive entirely as indicated above.
>>   
>> 
> 
> Quoting from the documentation:
> 
> The following table lists the object variables that will be implicitly inherited from related objects if you don't explicitly specify their value in your object definition or inherit them from a template
> 
> ...so I need to not inherit the value from my template.  How do I do that?

Don't specify the directive in the template.

> In some cases you may not want your host, service, or contact definitions to inherit values of string variables from the templates they reference. If this is the case, you can specify "null" (without quotes) as the value of the variable that you do not want to inherit.

You're mixing sections of the documentation to try to make a connection that doesn't exist. Again, specified with a value of 'null' does not equate to unspecified. Looking at the code, if you specify the value in any way, including a value of 'null', it breaks the implied inheritance.

xodtemplate.h --

#define XODTEMPLATE_NULL                  "null"

xdata/xodtemplate.c -- 

        else if(!strcmp(variable,"notification_period")){
            if(strcmp(value,XODTEMPLATE_NULL)){
                if((temp_service->notification_period=(char *)strdup(value))==NULL)
                    result=ERROR;
                    }
            temp_service->have_notification_period=TRUE;
                }

'If the variable is "notification_period" and the value is not the word "null", save the value unless the value is blank (error otherwise). If the value is the word "null" or something else, set the service have_notification_period flag to TRUE."

Further down --

        /* services inherit notification period from host if not already specified */
        if(temp_service->have_notification_period==FALSE && temp_host->have_notification_period==TRUE && temp_host->notification_period!=NULL){
            temp_service->notification_period=(char *)strdup(temp_host->notification_period);
            temp_service->have_notification_period=TRUE;
            }

"If the service 'have_notification_period' flag is not TRUE and the host and the host has a notification period, use that for the service."

As you can see, you fail that first condition.

> If I don't specify a value, it'll be inherited.  Right?  How will that help me not specify a value for the service?

If you don't specify the value in the template, there's nothing to inherit from the template. If the directive is also not specified in the service{} definition, the template engine will look to the value in the host{} definition.

--
Marc




------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
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