Good Practices: Host templates and service templates, how they work together

This post is also available in: French

We already introduce you to service templates and how you should use them. Host templates exist as well and have roughly the same features than service templates. But it’s important to know how to use all features to industrialize your configuration. So, you will find in this article all features you have to manage to optimize your Centreon platform.

Definition

A host template is a Centreon monitoring object that has all the characteristics needed to define an host. You can use it as basis for host configuration. There is a strong link between host template and service template: they are pre-configured objects that you can use in host.
You find the same characteristics:

  • legacy/inheritance: A host can inherit from a host template and it inherits all parameters which have been set up in the “parent” host template.
  • overload: when a host inherits from an host template, you always have the option to “force/overwrite” a parameter from the template.

In practical terms,to define an host template, go to the page “Configuration->hosts->Templates” and click on the link “add”:

01_Ajoutmodelehote

The host template have additional features than service templates:

  • multiple legacy/inheritance
  • relation between service template

Multiple legacy/inheritance

A host template can inherit from several host templates, unlike a service that can inherit only from one service template. When you create a host, with Centreon, you can define if the host inherits from several host templates at a time. For example, below:

02_Ajouthotebasesurmodelesmultiples
In the above example, the host inherits from different host templates: HW-DELL, Servers-Linux, Infra-DB-MySQL and Infra-HTTP. It means that host inherits all parameters previously entered in the template.
The order is important because it defines the legacy order of parameters. A specific parameter can be defined in several host templates. The order that you choose for the legacy and with which you choose a model is dominant. For example, if the test interval of the host is defined for each host template below, the inherited parameters correspond to the parameter that you define in the first chosen element (HW-Dell in our example).

Where does the multiple legacy principle come from? You have seen that it wasn’t necessary for services to have multiple legacy template, so why should it be necessary for a host to have it ? The answer is about the parameter «Create services linked to template too”. This parameter allows the setting up of associative legacy, useful link. Indeed, a “host” server can receive several «under-hosts” as database and application servers for example.

Relation host template with service template

A host template can be linked to one or several service template. for example, the host template “HW-Dell” can be linked to these following service templates :

  • hw-dell-cpu : monitoring of hardware functioning for each real CPU
  • hw-dell-dimm: monitoring of hardware functioning for RAM module
  • hw-dell-raid: monitoring of hardware functioning for RAID controller

Considering this fact and if the option “Create services linked to template too” is configured “yes”, each time a host inherit from a host template, service template of host template will be reproduced in service on the host. It means that there is not legacy but a service creation.

Strategy

Once again, the aim is to save your time. Using templates, we want to simplify the process by deploying services automatically. We think that is a better idea than to create service for each host. Thanks to the following configuration strategy, you can accelerate the configuration:

1. To share your IT infrastructure in several parts :

  • servers :
    • hardware
    • operating system
    • applications
  • network :
    • switch
    • router
    • firewall

2. To create a host template by different component, for example for the hardware :

  • hardware
    • host template: HW-Dell
    • host template: HW-IBM
    • host template: HW-HP

3. To do the same for others components : operating system, applications, etc.

4. To create service template by monitoring applicator

5. To associate these service templates to the adequate host template

6. To create hosts based on host template

3. To do the same for others components : operating system, applications, etc.

4. To create service template by monitoring applicator

5. To associate these service templates to the adequate host template

6. To create hosts based on host template

So, using Centreon become easier for operating team. To create a host, the user has to wonder the following questions:

1. Is it a server? If the answer is yes, so:

  • what is its hardware ? (example : Dell)
  • What is its OS? (example : Linux)
  • What are their applications which work with the server ? (example : MySQL or Apache)

2. Is it network equipment ? If the answer is yes, so:

  • What is the type of equipement ?

3. …

Once it’s done, it’s easier to define a host in Centreon : you have to select the fitting host templates. It’s now useless to know the server list that you have to create and parameters that you have to give to these services. Configuration made easy!

Updated by lpinsivy the 2014/01/13

Incoming search terms:

  • centreon templates
  • GoodPractices:Hosttemplatesandservicetemplates howtheyworktogether|BlogCentreon

3 thoughts on “Good Practices: Host templates and service templates, how they work together

  1. Hi,

    I have beeing reading this articles and found them really interesting. I´m seriously considering on changing my actual organizational hierarchy to fit the good practices.

    Anyway, Ive found a problem while I was thiking of how I was going to achieve that goal. I can not assign host templates to host groups or service templates to service groups. I found them a must, as they are vital to get the Centreon BI Informs I need on one hand, and are usefull filters in the ACLs for users view in the other.

    How Do you Deal with Host and Service Groups? Do you need to go host by host and service by service assignin them when the services are generated automatically due to the template assignements?

    Regards and thank you for your help in advance.

    Ecke

  2. Pingback: Non, Centreon n’autorise pas les hostgroups pour les modèles d’hôtes | Zwindler's Reflexion

Leave a Reply