Page 1 of 1
Host Template applied to Host Group
Posted: Fri Feb 14, 2020 2:08 pm
by rkane
I'm attempting to apply a host template using host groups. Meaning: host A is a member of XYZ host group and, therefore, has host template X applied. This does not appear to work as expected.
- If I apply host template X to host A directly it works fine
- If I apply host template X to a host group that host A is in, and remove host template X from host A directly, I get an error that certain required parameters are missing (the standard "you need to have check intervals and things set up").
I know those parameters are set up properly in the template as applying the template directly works just fine. Why is applying the template via host group not doing the same?
Re: Host Template applied to Host Group
Posted: Fri Feb 14, 2020 3:04 pm
by jdunitz
A template has to have at least one host defined to it in order for it to work.
So, you'd have to set up host-a to template-X, then apply the hostgroup. The order is important, in this case.
Hope that helps!
Re: Host Template applied to Host Group
Posted: Fri Feb 14, 2020 3:13 pm
by rkane
jdunitz wrote:A template has to have at least one host defined to it in order for it to work.
So, you'd have to set up host-a to template-X, then apply the hostgroup. The order is important, in this case.
Hope that helps!
Appreciate it, this particular template has about 200 hosts directly related to it currently. I was experimenting with one of those hosts to see if I could assign to all of those via group. Regarding the order....would I need to have a template (any template) assigned to host a, then apply to the group, then remove the placeholder template from host a?
Re: Host Template applied to Host Group
Posted: Fri Feb 14, 2020 3:35 pm
by scottwilkerson
No matter what, you need a host definition for each host. The definition can be as simpe as
Code: Select all
define host {
host_name myhost
use mytemplate
register 1
}
that said, if the host is simple like this, everything that is required would need to be in the template.
But you cannot take a template and apply it to a host group, hostgroups do not have templates.
Re: Host Template applied to Host Group
Posted: Fri Feb 14, 2020 3:45 pm
by rkane
scottwilkerson wrote:No matter what, you need a host definition for each host. The definition can be as simpe as
Code: Select all
define host {
host_name myhost
use mytemplate
register 1
}
that said, if the host is simple like this, everything that is required would need to be in the template.
But you cannot take a template and apply it to a host group, hostgroups do not have templates.
Right...but a host cannot pick up all of it's information (save for the basics above) from being a member of a host group? Another way to ask that...what is the purpose of adding a hostgroup to a host template?
Really, this answer doesn't make a lot of sense. If I apply the template to the host directly everything is fine. If I apply the template to a host group that the host is in and remove the template being directly applied it doesn't work.
In that scenario, if I didn't have a basic host definition I would not be able to apply a template to it directly correct?
Re: Host Template applied to Host Group
Posted: Fri Feb 14, 2020 3:59 pm
by scottwilkerson
rkane wrote:what is the purpose of adding a hostgroup to a host template?
If you want all hosts that have that template applied to be added to the hostgroup
Re: Host Template applied to Host Group
Posted: Fri Feb 14, 2020 4:01 pm
by rkane
scottwilkerson wrote:rkane wrote:what is the purpose of adding a hostgroup to a host template?
If you want all hosts that have that template applied to be added to the hostgroup
ahhhhhhh!!!
So backwards of what I'm thinking. The template is applied directly to all the hosts and the group membership is defined by the fact that the template is applied to that host.
Re: Host Template applied to Host Group
Posted: Fri Feb 14, 2020 4:15 pm
by lmiltchev
Yeah, it could be a bit confusing. Let us know if it's ok to lock this thread. Thanks!
Re: Host Template applied to Host Group
Posted: Mon Feb 17, 2020 7:12 am
by rkane
lmiltchev wrote:Yeah, it could be a bit confusing. Let us know if it's ok to lock this thread. Thanks!
OK, to lock, thank you
Re: Host Template applied to Host Group
Posted: Mon Feb 17, 2020 7:42 am
by scottwilkerson
rkane wrote:lmiltchev wrote:Yeah, it could be a bit confusing. Let us know if it's ok to lock this thread. Thanks!
OK, to lock, thank you
Great!
Locking thread