Assign a group of service templates to a host or host group

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
tom_wong
Posts: 37
Joined: Thu Oct 25, 2012 9:13 am

Assign a group of service templates to a host or host group

Post by tom_wong »

Hi, I have a similar question but was locked. (http://support.nagios.com/forum/viewtop ... f=6&t=8118)

Scott recommended me to

1) You could create 1 template that has the group of templates attached to it, and them just add that one newly created template to the host/service.

I have done that, I created 1 template to have 2 service templates attached to it.

However after running the service, on the Service Status window, under the 'status information' column, Nagios only displays the first service template result, it would not display the other service templates results under this main template.

Also, under performance graph, it only shows the first template associated with it and not the rest.

How do I ask nagios to display all service templates results?

Thanks
Tom
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Assign a group of service templates to a host or host gr

Post by scottwilkerson »

A template is only applied to a host. Adding multiple templates to a host will not add the services to that host.

What you want to do is create a service with all the specifications you want, and then you can add either multiple hosts or a hostgroup to that service to have it applied to all of the hosts.

For example, you add the hostgroup linux-servers to the service you created.

It will be added to EVERY host that is a member of the linux-servers hostgroup. If you add another host to the hostgroup in the future, it will automatically add this service.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tom_wong
Posts: 37
Joined: Thu Oct 25, 2012 9:13 am

Re: Assign a group of service templates to a host or host gr

Post by tom_wong »

Hi Scott, I have done what you recommended me to do using service templates.

(1) I have create many snmp service templates.
(2) I create a main service template and associate the above templates to it.
(3) I create a service and associate the (2) service template to it.
(4) Assign the above service to a host
(5) The hosts runs and the above service will always only show the output of the first template associated with it. Say there are two templates (state and type) assoicated with the main service template. The service only displays the states values all the time and not showing the rest template result.

I want to be able to create many service templates especially for a host, create an umbrella service template for these service templates, create a new service with that umbrella service template and assign this service to the host. However, the serice status information only shows the first template output.

host
service
main service template
service template 1
service template 2
service template 3

From the above structure, the service status window, only shows the 'service template 1' for the service.

Thanks
Tom
mguthrie
Posts: 4380
Joined: Mon Jun 14, 2010 10:21 am

Re: Assign a group of service templates to a host or host gr

Post by mguthrie »

Take a look at the following doc. This covers how object inheritance works with templates.
http://nagios.sourceforge.net/docs/3_0/ ... tance.html
tom_wong
Posts: 37
Joined: Thu Oct 25, 2012 9:13 am

Re: Assign a group of service templates to a host or host gr

Post by tom_wong »

Hi mguthrie,

I think I understand the object inheritance in Nagios. As I said I have done that according to scott's recommedation.

Let me again tell you what I have done,

(1) I create service template A and service template B
(2) I create another service template C inherited from the above service template A and B
(3) I create a service D inerherited from service template C and associated it to a Host

When Nagios run check the Host's service D, it only show service template A result on the 'Service Status' window. My question is why Nagios's Service status window doesn't show both Servcie template A and B results?

Tom
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Assign a group of service templates to a host or host gr

Post by scottwilkerson »

Actually my recommendation had nothing to do with templates.

It has to do with creating new services and adding multiple hosts or a hostgroup for them
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tom_wong
Posts: 37
Joined: Thu Oct 25, 2012 9:13 am

Re: Assign a group of service templates to a host or host gr

Post by tom_wong »

Hi Scott,

please refer to my last locked post

http://support.nagios.com/forum/viewtop ... f=6&t=8118

From your answer,
1) You could create 1 template that has the group of templates attached to it, and them just add that one newly created template to the host/service.

I followed, but why Nagios's Service status window doesn't show both Servcie template A and B results? If both template checks return OK, Nagios just shows template A result, or if template B returns critical results, it only displays template B result.

Tom
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Assign a group of service templates to a host or host gr

Post by scottwilkerson »

I think you misunderstood my answer.

You can add multiple templates to a host or service, but only only 1 setting for each item will be applied, with any setting in the service or host definition overriding any of the values.

This doesn't create multiple services. If you apply templates to a host, these will just be applied to the host check, it WILL NOT add services.

You need to create a service. Then you can add as many hosts to that service that you want to. So you go to Configure -> CCM -> Services -> Add New

Then you can select what hosts you want to add this service setup to, it can be a single host, several hosts, or you can select a hostgroup and the service will be created for every host in the hostgroup.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
tom_wong
Posts: 37
Joined: Thu Oct 25, 2012 9:13 am

Re: Assign a group of service templates to a host or host gr

Post by tom_wong »

Hi Scott, I didn't misunderstand you answer.

We have an snmp agent running on a device would provide up to 20 snmp values. We would like to create one snmp service template for each snmp value. Then add these templates to one umbrella service template.

Then we can assign this one umbrella service template to a servcie. Then we can add this service to any host with the same device types. However, with this method, Nagios only display the first service template result under the umbrella service template. We want Nagios to display all 20 snmp values (all 20 service template check results).

So, from what you said, we have to create 20 services and each time, we have to assign individual service to individual host. If we deplpy 20 hosts, then we have to assign 20 service to 20 hosts, that is 400 assignments. Using the above method, we only assign 1 service to 20 hosts.

Can you clarify, please?

Thanks
Tom
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Assign a group of service templates to a host or host gr

Post by scottwilkerson »

No matter how many templates you apply, there will only be one check performed.

In the method I outlined above, you will setup 20 services and can set add a hostgroup if you like.

Then when you create the 20 hosts all you need to do is add the host to that hostgroup while creating the host, the system will automatically add all of these services to EVERY host in that hostgroup.

So instead of your 400 assignments, you simply just create the 20 hosts making sure you add the hostgroup.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked