Question on services and templates

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
gregwhite
Posts: 206
Joined: Wed Jun 01, 2011 12:40 pm

Question on services and templates

Post by gregwhite »

Can you assign the same services to different service templates, and then assign each service template to a host group? So if you had a disk check service and it was assigned to 3 service templates that are assigned to 3 host groups, the disk service would be handled by each template for the servers in the host group they are assigned to?

Thanks,
Greg
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Question on services and templates

Post by benjaminsmith »

Hi Greg,

Hopefully, I'm understanding the question correctly, so let me know if I'm wrong. In Nagios, groups are simply a way of organizing collections of hosts and services. So hostgroups definitions do not include a template directive.

That said the inheritance rules in Nagios are sophisticated ( see this ). So if you created 3 hostgroups and then three different service templates, each template could contain the hostgroup and those services would inherit the settings from the template associated with the hostgroup. However, since the service is not directly linked to the template, you'll likely get an error for the required settings in XI.

However, I would recommend keeping it simple and create basic templates for the disk service, and assign the correct template when creating a new service. You can also use the Bulk Modifications tool in Nagios to make changes to large numbers or host and services.
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!
gregwhite
Posts: 206
Joined: Wed Jun 01, 2011 12:40 pm

Re: Question on services and templates

Post by gregwhite »

Thanks. I probably didn't clearly explain. We create host groups based on the function of a device. So we may have a group of window servers and have divided them up into 3 host groups. Production, Test and Development. We have defined a set of services that we will check on all window servers such as CPU, Disk, Memory, Netlogon, etc. I want to create 3 service templates each with the same service checks applied to each template. Each of those templates we be assigned to one of those host groups. The difference would be with the production servers we would page on a critical alert where we would just email for a test server. So because the requirements on a production server are different from a test server we would use a different service template even thought the service checks would be the same.
Also, can a host template be assigned to a host group and have devices you add to that host group inherit that template. I tried this and it didn't work so I am wondering if you can't or did I do something wrong.

Thanks,
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Question on services and templates

Post by npolovenko »

@gregwhite
I want to create 3 service templates each with the same service checks applied to each template.
The problem is that if you apply multiple templates to a single service, Nagios will automatically compile everything into a single service configuration. Nagios will not create 3 services with 3 sets of configurations.
Your only option is to create three different service checks and assign them to three host groups.
Also, can a host template be assigned to a host group and have devices you add to that host group inherit that template. I tried this and it didn't work so I am wondering if you can't or did I do something wrong.
That won't work either. Only hosts that are inheriting from this host template will be automatically assigned to the host group.

Host Templates and Service Templates are just layers in the configuration. For example, if a service doesn't have a check command defined, nagios will look into the template and if the template does have the check command defined, then the final service definition that nagios will compile after you click on Apply Configuration will have this check command defined.
Same applies to hostgroups. If no hotgroups are selected for the service, nagios will look at the template and if the template has some hostgroups assigned, then the final service definition will have a hotgroup directive in the compiled configuration.

Code: Select all

    hostgroup_name           inherited from the template
 
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked