Linking templates to hosts

Now we'd like to link this template to our very first host, A test host. First, let's compare item lists between the freshly-created template and that host:

  1. Open Configuration | Hosts in one browser window or tab and Configuration | Templates in another.
  2. In the first window, choose Linux servers in the Group drop-down, then click on Items next to A test host.
  1. In the other one, select Custom templates in the Group drop-down, then click on Items next to C_Template_Linux. Place the windows next to each other and compare the listings:

We can see that the template has three more items than the host. Looking at the lists on the left side of the screenshot and the right, we can see that items available on the template (right) but not on the host (left) are both SNMP-related items that we added later, experimental SNMP trap and snmptraps, the local time item, and also the check for a file, Testfile, exists. If the template has four items that the host is missing, but in total, it only has three items more, then that means the host should have one item that the template doesn't.  That's right, the full OS name exists for the host but is missing in the template. Keep that in mind, and return to Configuration | Hosts.

Make sure the Group drop-down says either all or Linux servers, and click on A test host in the Name column. We finally get to use the Templates tab—switch to it. Start typing C in the Link new templates input field. In the drop-down, our new template, C_Template_Linux, should be the very first one. Click on it. Even though it might seem that this template is now added, it actually isn't; if we were to update the host now, it would not be linked:

Click on the Add control just below the template name. This form can be highly confusing, so try to remember that you have to do that extra click here. With the template added to the list, notice that it's actually a link. Clicking it will open template properties in a new window. When looking at host properties, this offers quick access to template properties. Such convenient links are available in many places in the Zabbix frontend:

In the end, click on the Update button at the bottom. We are now welcomed with a message that tells us that our host is updated with the information from our template:

When a template is linked to a host, identical entities that already exist on the host are linked against the template, but no historical data is lost. Entities that exist on the template only are added to the host and linked to the template.
Do not confuse templates with host groups. They are completely different things. Groups serve a logical host grouping (and permission assigning), but templates define what is monitored on a host, what graphs it has, and so on. What's more, a single host group can contain both ordinary hosts and templates. Adding a template to a group will not affect hosts in that group in any way; only linking that template will. Think of groups as a way to organize the templates the same way as hosts are organized.

Now, we can check out how linked items appear in the configuration:

  1. Open Configuration | Hosts
  2. Click on Items next to A test host:

There are two observations we can make right away:

  • Almost all items are prefixed with a template name (C_Template_Linux in this case) in grey text. Obviously, this indicates items that are linked from the template. Clicking on the template name would open an item listing for that template.
  • A single item (full OS name) is not prefixed. Remember, this was the only item existing on the host, but not on the template. If entities exist on the host only, linking does not do anything to them; they are left intact and attached to the host directly.

Let's see what a linked item looks like. Click on SMTP server status in the Name column:

Hey, what happened? Why are most fields greyed out and can't be edited? Well, that's what a template is about. Most of the entity (in this case, an item) parameters are configured in the template. As we can see, some fields are still editable. This means that we still can disable or enable items per individual host, even when they are linked in from a template. The same goes for the update interval, history length, and a few other parameters.

We now want to make this particular item for this host slightly different from all other hosts that the template will be linked to, so let's change these things:

  • Update interval: 360
  • History storage period: 60

When you are done, click on Update. Now, this host will have two parameters customized for a single item, while all other hosts that will get linked against the template will receive values from the template. Let's link one more host to our template now. Navigate to Configuration | Templates. Here we can see a full list of templates, along with the hosts linked to them. The linkage area in this screen shows various entries and listed entities there have different colors:

  • Gray: Templates
  • Green: Enabled hosts
  • Red: Disabled hosts

Go back to Configuration | Hosts and go to Another host to the Template tab. Link this host with our template C_Template_Linux, just as we did in previous task, with our A test host. Take a look at the item SMTP server status on both hosts, and you will see that our Another host has the interval defined from our template, while our A test host has the updated values.

You used to be able to link templates to hosts from the Template section in Zabbix. However, Zabbix SIA has been cleaning up the interface to make things easier for end users and less confusing, and this functionality was lost in the process.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.171.121