Page 1 of 1

Host and Service Templates

Posted: Thu Mar 07, 2013 11:22 am
by TRod
I'm running Nagios XI 2012R1.6, in Evaluation Mode.

I've been trying to get Host and Service Templates to cooperate, and I'm having a devil of a time.

My understanding is that a Template is a group of settings that can be inherited by an object. In that interpretation, I should be able to define a Service Template, assign that to a Host, and that host would inherit all of the services in the Service Template. Likewise, if I assigned a Service Template to a Hostgroup, all of the hosts in that Hostgroup should inherit all of the services in the associated Service Template. Is that a correct analysis?

I can't get this to work.

Just for reference, here are my precise steps:

1. Log into NagiosXI CCM
2. Define a generic host
3. Define a Service Template
4. In the Service Template definition, select "Manage Hosts"
5. Select my Host and add it (I've tried +, null, and standard)
6. Reload the configuration
7. Check Service Detail
8. No services defined on my new host

I've also tried associating the Service Template with a Hostgroup. I've also tried defining Hostgroup Templates, then associating those to a Hostgroup.

None of these work.

Is there a concise guide on how to configure this sort of functionality in NagiosXI? Is the evaluation mode crippled? Am I doing something horribly wrong? Or is this the wrong method of inheritance? I have a large number of homogenous hosts I need to monitor, and I need the capability to change service definitions across the whole landscape without having to hand edit each host. Are Templates the right method of doing this?

Also, what is the difference between a Service Template and a Hostgroup Template?

Thanks very much for any assistance.

Re: Host and Service Templates

Posted: Thu Mar 07, 2013 12:02 pm
by lmiltchev
I should be able to define a Service Template, assign that to a Host, and that host would inherit all of the services in the Service Template.
This functionality is not available in Nagios XI. You can only assign a host template to a host, and a service template to a service.

You can however apply a service to a hostgroup. It will get inherited by all of the members of the hostgroup. Later on, when you add new members, they would also inherit this service.

You can also chose to maintain the configuration data outside of the NagiosQL database by placing your configs in the "/usr/local/nagios/etc/static/" directory. Configuration files in this directory are not imported into NagiosQL.

Re: Host and Service Templates

Posted: Thu Mar 07, 2013 12:36 pm
by TRod
Thanks for the response, but I have a further question.
lmiltchev wrote:You can however apply a service to a hostgroup. It will get inherited by all of the members of the hostgroup. Later on, when you add new members, they would also inherit this service.
So then, this is method you recommend:

1. Log in to CCM
2. Create a hostgroup (apply config to check each step)
3. Add a host and add it to the host group (apply config)
4. Go to Services and define a service (apply config)
5. From the service, associate a hostgroup (apply config)

After applying the config, I checked the Service detail. No services listed for the new host. I tried removing the host from the Hostgroup and re-adding it. No dice. I tried going into the Service itself and adding it explicitly to the Host. No dice.

What am I doing wrong?

Re: Host and Service Templates

Posted: Thu Mar 07, 2013 12:43 pm
by TRod
Okay, I figured it out. CCM was showing that the check was active. Legacy CCM was showing the check as NOT being active. Once I flipped it to active, all hosts in the hostgroup inherited the check.

Is this a known issue?

Re: Host and Service Templates

Posted: Thu Mar 07, 2013 4:07 pm
by slansing
Not that I know of personally, it may be worth reporting as a bug at http://tracker.nagios.com/