Re: [Nagios-devel] Reason for dropping contact_groups from hostgroup
Posted: Wed Jun 08, 2005 2:44 am
Yann DIRSON wrote:
> Andreas wrote:
>
>>Make heavy use of templates.
>
>
> Unfortunately, unless I miss something, I cannot "use" several other
> templates when building a host block, whereas I can declare my host as
> being part of several hostgroups. And if we could, we would have to
> define precedence rules between them, which would I think be more
> complicated than just getting new contact_groups from all hostgroups.
>
> What I do now is building new templates (ou1-os1-server, ou2-os3-server,
> ou1-infra, etc.) as the need arise. But there are several issues:
> - it is repetitive work to create them
man 1 sed, or read an online tutorial for it.
You can also turn on regular expression matching and name your
hostgroups so that you can use it easily. It will triple the load-time
of nagios but you will get what you want (with fewer lines of config
than earlier).
> - there are combinatory scaling issues: number of templates is #os * #ou *
> #types. For each new ou I have a number of templates, where I would only
> have to add a single hostgroup.
> - all those -server templates inherit a generic-server template with a
> given contact_groups, I have to explicitely repeat it and append new
> groups, since I do not know how to just add contact_groups. Duplicated
> information is always bad, especially as the configuration gets bigger.
>
Nagios doesn't normalize its configuration anyway, so a lot of info is
already duplicated.
> Indeed, I notice that nagios does not complain if I add several "use"
> clauses in a host block, but I guess the last one takes precedence, since
> it is what seems to happen with other fields like host_name.
True. You can do
contact_groups *
in the "master" template, and exclude them in the others(contact_groups
!notwanted). That way it will get complemented rather than overwritten.
> Note that if
> this is intended behaviour, I guess it should be documented in
> xodtemplate.html, but I'd be more comfortable with nagios throwing out an
> error in such cases.
>
It is intended behaviour (an easter egg, more like it, but it's nifty).
Feel free to submit a patch for the documentation.
> And while I'm at documentation issues, I'd find it pretty useful to have
> the main doc index link to xodtemplate, and maybe templaterecursion as
> well. Currently the user has to guess through which page going to find a
> link to this information. Possibly some other docs would need similar
> promotion.
>
Like I said; Feel free to submit a patch to fix the documents. As
always, coding comes first and documentation later. The other way around
is only possible when making a new implementation of an already
standardized interface/protocol/whatever.
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Lead Developer
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
> Andreas wrote:
>
>>Make heavy use of templates.
>
>
> Unfortunately, unless I miss something, I cannot "use" several other
> templates when building a host block, whereas I can declare my host as
> being part of several hostgroups. And if we could, we would have to
> define precedence rules between them, which would I think be more
> complicated than just getting new contact_groups from all hostgroups.
>
> What I do now is building new templates (ou1-os1-server, ou2-os3-server,
> ou1-infra, etc.) as the need arise. But there are several issues:
> - it is repetitive work to create them
man 1 sed, or read an online tutorial for it.
You can also turn on regular expression matching and name your
hostgroups so that you can use it easily. It will triple the load-time
of nagios but you will get what you want (with fewer lines of config
than earlier).
> - there are combinatory scaling issues: number of templates is #os * #ou *
> #types. For each new ou I have a number of templates, where I would only
> have to add a single hostgroup.
> - all those -server templates inherit a generic-server template with a
> given contact_groups, I have to explicitely repeat it and append new
> groups, since I do not know how to just add contact_groups. Duplicated
> information is always bad, especially as the configuration gets bigger.
>
Nagios doesn't normalize its configuration anyway, so a lot of info is
already duplicated.
> Indeed, I notice that nagios does not complain if I add several "use"
> clauses in a host block, but I guess the last one takes precedence, since
> it is what seems to happen with other fields like host_name.
True. You can do
contact_groups *
in the "master" template, and exclude them in the others(contact_groups
!notwanted). That way it will get complemented rather than overwritten.
> Note that if
> this is intended behaviour, I guess it should be documented in
> xodtemplate.html, but I'd be more comfortable with nagios throwing out an
> error in such cases.
>
It is intended behaviour (an easter egg, more like it, but it's nifty).
Feel free to submit a patch for the documentation.
> And while I'm at documentation issues, I'd find it pretty useful to have
> the main doc index link to xodtemplate, and maybe templaterecursion as
> well. Currently the user has to guess through which page going to find a
> link to this information. Possibly some other docs would need similar
> promotion.
>
Like I said; Feel free to submit a patch to fix the documents. As
always, coding comes first and documentation later. The other way around
is only possible when making a new implementation of an already
standardized interface/protocol/whatever.
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Lead Developer
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]