Zabbix Documentation 2.0

3.04.04.2 (current)In development:4.4 (devel)Unsupported:1.82.02.22.43.23.4

User Tools

Site Tools


Sidebar

manual:config:templates:linking

2 Linking/unlinking

Overview

Linking is a process whereby templates are applied to hosts, whereas unlinking removes the association with the template from a host.

Templates are linked directly to individual hosts and not to host groups. Simply adding a template to a host group will not link it. Host groups are used only for logical grouping of hosts and templates.

Linking a template

To link a template to the host, do the following:

  • Go to Configuration → Hosts
  • Click on the required host and switch to the Templates tab
  • Click on Add
  • Select one or several templates in the popup window
  • Click on Save in the host attributes form

The host will now have all the items, triggers, graphs, applications, screens and low-level discovery rules of the template.

Linking multiple templates to the same host will fail if in those templates there are items with the same item key or applications with the same name. And, as triggers and graphs use items, they cannot be linked to a single host from multiple templates either, if using identical item keys.

When entities (items, triggers, graphs etc.) are added from the template:

  • previously existing identical entities on the host are updated as entities of the template
  • entities from the template are added
  • any directly linked entities that, prior to template linkage, existed only on the host remain untouched

In the lists, all entities from the template now are prefixed by the template name, indicating that these belong to the particular template. The template name itself (in grey text) is a link allowing to access the list of those entities on the template level.

If some entity (item, trigger, graph etc.) is not prefixed by the template name, it means that it existed on the host before and was not added by the template.

Entity uniqueness criteria

When adding entities (items, triggers, graphs etc.) from a template it is important to know what of those entities already exist on the host and need to be updated and what entities differ. The uniqueness criteria for deciding upon the sameness/difference are:

  • for items - the item key
  • for triggers - trigger name and expression
  • for custom graphs - graph name and its items
  • for applications - application name
Linking templates to several hosts

There are some ways of mass-applying templates (to many hosts at once):

  • To link a template to many hosts, in Configuration → Templates, click on the template, then select hosts from the respective group in the Other box, click on « and save the template.

Vice versa, if you select the linked hosts in the In box, click on » and save the template, you unlink the template from these hosts (while the hosts will still inherit the items, triggers, graphs etc. from the template).

  • To update template linkage of many hosts, in Configuration → Hosts select some hosts by marking their checkboxes, then choose Mass update below the list, click on Go and then from all the options select to link additional templates:

Click on Add to select the templates to link. The Replace option allows to unlink the previously linked templates, before linking the new ones. When choosing to replace, there is also the Clear when unlinking option. Marking that will remove all the entities (items, triggers, graphs, etc) previously linked to the hosts by the linked templates.

Zabbix offers a sizable set of predefined templates. You can use these for reference, but beware of using them unchanged in production as they may contain too many items and poll for data too often. If you feel like using them, finetune them to fit you real needs.
Editing linked entities

If you try to edit an item or trigger that was linked from the template, you may realize that many key options are disabled for editing. This makes sense as the idea of templates is that things are edited in one-touch manner on the template level. However, you still can, for example, enable/disable an item on the individual host and set the update interval, history length and some other parameters.

If you want to edit the entity fully, you have to edit it on the template level (template level shortcut is displayed in the form name), keeping in mind that these changes will affect all hosts that have this template linked to them.

Unlinking a template

To unlink a template from a host, do the following:

  • Go to Configuration → Hosts
  • Click on the required host and switch to the Templates tab
  • Click on Unlink or Unlink and clear next to the template to unlink
  • Click on Save in the host attributes form

Choosing the Unlink option will simply remove association with the template, while leaving all its entities (items, triggers, graphs etc.) with the host.

Choosing the Unlink and clear option will remove both the association with the template and all its entities (items, triggers, graphs etc.).