Host Template applied to Host Group

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
rkane
Posts: 114
Joined: Wed Aug 15, 2018 3:56 pm

Host Template applied to Host Group

Post 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?
User avatar
jdunitz
Posts: 235
Joined: Wed Feb 05, 2020 2:50 pm

Re: Host Template applied to Host Group

Post 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!
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
rkane
Posts: 114
Joined: Wed Aug 15, 2018 3:56 pm

Re: Host Template applied to Host Group

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Template applied to Host Group

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
rkane
Posts: 114
Joined: Wed Aug 15, 2018 3:56 pm

Re: Host Template applied to Host Group

Post 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?
Last edited by rkane on Fri Feb 14, 2020 4:00 pm, edited 1 time in total.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Template applied to Host Group

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
User avatar
rkane
Posts: 114
Joined: Wed Aug 15, 2018 3:56 pm

Re: Host Template applied to Host Group

Post 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.
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: Host Template applied to Host Group

Post by lmiltchev »

Yeah, it could be a bit confusing. Let us know if it's ok to lock this thread. Thanks!
Be sure to check out our Knowledgebase for helpful articles and solutions!
User avatar
rkane
Posts: 114
Joined: Wed Aug 15, 2018 3:56 pm

Re: Host Template applied to Host Group

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Host Template applied to Host Group

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked