Object Definitions with Multiple Templates

Marc Powell marc at ena.com
Wed Sep 23 18:36:18 CEST 2009


On Sep 23, 2009, at 10:32 AM, Tata, Joseph wrote:

> On Wed, Sep 23, 2009 at 10:05 AM, Tata, Joseph  
> <jtata at gpworldwide.com> wrote:
>> I am having a problem getting Nagios to accept multiple templates in
>> object definitions.
>>
>> Here is an example.  I have two templates defined in templates.cfg:


>> Instead when I run nagios -v I get:
>>
>> "Error: Template 'prod-host,win-host' specified in host definition  
>> could
>> not be not found" etc.


This works just fine in my install of nagios (nagios-HEAD from about a  
month an a half ago). I pretty much took your config verbatim. I don't  
know why it doesn't work for you. Does the template named 'host'  
exist? Note also that I believe your intent is to have 'hostgroups  
+win_servers' in your win-host template but it's irrelevant to the  
issue you're reporting.

Here's what I tested with --

define host{
         name                            generic-host
         notifications_enabled           1       ; Host notifications  
are enabled
         event_handler_enabled           1       ; Host event handler  
is enabled
         flap_detection_enabled          0       ; Flap detection is  
enabled
         process_perf_data               0       ; Process performance  
data
         retain_status_information       0       ; Retain status  
information across program restarts
         retain_nonstatus_information    1       ; Retain non-status  
information across program restarts
         max_check_attempts              1
         check_period                    24x7
         checks_enabled                  1
         notification_interval           0
         notification_period             none
         notification_options            d,r
         initial_state                   o

         register                        0       ; DONT REGISTER THIS  
DEFINITION - ITS NOT A REAL HOST, JUST A TEMPLATE!
         }


define host {
use                             generic-host
name                            prod-host
hostgroups                      prod_servers #Production server host
notification_period             24x7
register                        0
}


define host {
use                             generic-host
name                            win-host
hostgroups                      win_servers #Windows server host group
register                        0
}

define host {
use                             prod-host,win-host
name                            windows-server
address                           192.1.1.1
alias                                     My Windows Production Server
}


-bash-2.05b$ bin/nagios -v etc/nagios.cfg

Nagios 3.1.2
Copyright (c) 2009 Nagios Core Development Team and Community  
Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 06-23-2009
License: GPL

{snip}

Total Warnings: 0
Total Errors:   0

Things look okay - No serious problems were detected during the pre- 
flight check


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
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