Template shortcut problem? *Resolved* - BUG?

Marc Powell marc at ena.com
Fri Mar 12 20:16:39 CET 2004


Well, to reply to my own email, I have a fix for this but it really
feels like a kludge and I still think I'm doing something wrong. To
resolve this I have created basically a dummy host and made it a member
of every hostgroup like so --

define host{
        use                     generic-host            ; Name of host
template to use

        host_name               template-host
        alias                   Template
        address                 127.0.0.1
        contact_groups  tnops
        }
define hostgroup {
        hostgroup_name  tnops-alcoa-tn
        alias           Alcoa Tennessee
        members         template-host
}
define hostgroup {
        hostgroup_name  all-middle-tn
        alias           All Middle Tennessee
        members         template-host
}
define hostgroup {
        hostgroup_name  all-west-tn
        alias           All West Tennessee
        members         template-host
}
...

Once I did this every other host in each hostgroup registered properly.

Checking services...
        Checked 2307 services.
Checking hosts...
Warning: Host 'template-host' has no services associated with it!
        Checked 1627 hosts.
Checking host groups...
        Checked 138 host groups.
Checking service groups...

I can live with the Warning and I hope it's just a temporary kludge
anyway. Is this normal? It feels like there is just a small hole in the
template logic somewhere.

--
Marc


On Thursday, March 11, 2004 2:35 PM, Marc Powell shared with us:

> Hi all! I'm starting to play around with 2.0a and I have it working
> so now I'm looking at doing some things with template-magic that I
> probably should have done a long time ago. Unfortunately I'm doing
> something wrong and could use another pair of eyes. I basically have
> about 1600 hosts that I'm looking at for this that are split up into
> 138 hostgroups with most hosts being in two different hostgroups. I'm
> trying to use template magic to eliminate having to specify each as
> an argument to the hostgroup 'members' directive by using the
> 'hostgroups' directive in the host definition and to simplify my
> configs like so --         
> 
> # Host definition
> define host {
>         use                     generic-host
>         host_name               <HOSTNAME REMOVED>
>         alias                   Alcoa Elementary/LEA
>         address                 <IP ADDRESS REMOVED>
>         hostgroups              all-east-tn,tnops-alcoa-tn
>         }
> 
> And the corresponding hostgroup definitions look like so --
> 
> define hostgroup {
>         hostgroup_name  tnops-alcoa-tn
>         alias           Alcoa Tennessee
> }
> 
> define hostgroup {
>         hostgroup_name  all-east-tn
>         alias           All East Tennessee
> }
> 
> Unfortnately pre-flight crashes and burns before take off --
> 
> Running pre-flight check on configuration data...
> 
> Checking services...
>         Checked 2307 services.
> Checking hosts...
>         Checked 1626 hosts.
> Checking host groups...
> Error: Host 'all-east-tn' specified in host group 'all-east-tn' is
> not defined anywhere! 
> Error: Host 'all-middle-tn' specified in host group 'all-middle-tn'
> is not defined anywhere! 
> Error: Host 'all-west-tn' specified in host group 'all-west-tn' is
> not defined anywhere! 
> Error: Host 'tnops-alamo-tn' specified in host group 'tnops-alamo-tn'
> is not defined anywhere! 
> Error: Host 'tnops-alcoa-tn' specified in host group 'tnops-alcoa-tn'
> is not defined anywhere! ... *****[137 total bad 'hosts']*****
>         Checked 138 host groups.
> Checking service groups...
>         Checked 0 service groups.
> Checking contacts...
>         Checked 1 contacts.
> Checking contact groups...
>         Checked 1 contact groups.
> Checking service escalations...
>         Checked 0 service escalations.
> Checking service dependencies...
>         Checked 0 service dependencies.
> Checking host escalations...
>         Checked 0 host escalations.
> Checking host dependencies...
>         Checked 0 host dependencies.
> Checking commands...
>         Checked 100 commands.
> Checking time periods...
>         Checked 4 time periods.
> Checking extended host info definitions...
>         Checked 0 extended host info definitions.
> Checking extended service info definitions...
>         Checked 0 extended service info definitions.
> Checking for circular paths between hosts...
> Checking for circular host and service dependencies...
> Checking global event handlers...
> Checking obsessive compulsive processor commands...
> Checking misc settings...
> 
> Total Warnings: 0
> Total Errors:   137
> 
> What's getting me is that the hosts that it's complaining about are
> only used as hostgroup names -- 
> 
> -bash-2.05b$ grep tnops-alcoa-tn *
> tnops-east.cfg: hostgroups              all-east-tn,tnops-alcoa-tn
> tnops-east.cfg: hostgroups              all-east-tn,tnops-alcoa-tn
> tnops-east.cfg: hostgroups              all-east-tn,tnops-alcoa-tn
> tnops-lea-tn.cfg:       hostgroup_name  tnops-alcoa-tn
> 
> 
> You'll also notice that 137 out of 138 hostgroups errored out. The
> single one that didn't does not have any hosts associated with it -- 
> 
> -bash-2.05b$ grep tnops-biz-tn *
> tnops-lea-tn.cfg:       hostgroup_name  tnops-biz-tn
> 
> 
> I thought it might be a wildcard issue (I do have
> use_regexp_matching=1) but disabling regexp matching doesn't have any
> effect. I know there's probably something obvious I'm missing but I
> can't seem to see it. The documentation is a bit unclear right now
> and I suspect it just hasn't been updated yet. The docs for hostgroup
> definitions state that the members directive is required while the
> docs for host definitions state that the hostgroups directive can be
> used in place of or in addition to the hostgroup members directive.  




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
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