Creating a template

Open Configuration | Templates. As we can see, there are already 81 predefined templates, compared with only 38 in Zabbix 3.0. Zabbix has done a great job in providing us with a bunch of standard templates to start with. We will create our own specialized one, though; click on Create template. This opens a simple form that we have to fill in:

  • Template name: C_Template_Linux
  • Groups: Custom templates

The C_ at the front of the name stands for custom. We are also creating a new group to hold our templates in, and instead of going through the group configuration, we use the shortcut for group creation on this form. When you type in the name, a box will be shown with our new group name and (new) behind it. Just click on it and the new group will be created, as there is no group yet with the name Custom templates. Don't worry about (new) being in the name of the group, that's just an indication to show us that this is a new group. When you are done, click on Add.

We now have the template, but it has no use—there are no items or triggers in it. Go to Configuration | Hosts, where we will use a lazy and quick solution; we will copy existing items and triggers into the new template. Select Linux servers in the Group drop-down, then click on Items next to Another host. Mark all items by clicking in the checkbox in the header, next to wizard, and click on the Copy button at the bottom.

Remember that to select a sequential subset of checkboxes, you can use range selection; select the first checkbox for the range, hold down Shift, and click on the last checkbox for the range.

On the next screen, do the following:

  1. Choose Templates in the Target type drop-down, and Custom templates in the Group drop-down.
  2. That leaves us with single entry, so mark the checkbox next to C_Template_Linux in the Target section.
  3. Click on Copy. All items should be successfully copied.

In this case, the destination template did not have any items configured. As it is not possible to have two items for a single host with the same key, attempting to copy over an already-existing item would fail.

In the upper-left corner, click on the Details link. That expands the messages, and we can see that all of these items were added to the target template:

Now we have to do the following steps with triggers:  

  1. Click on Triggers in the navigation bar above the item list, then click the checkbox in the header next to Severity.
  2. Uncheck the One SSH service is down, because this trigger spans both hosts. If we copied this trigger to the template, that would create all kinds of weird effects.
The sequence here—copying items first, then triggers—was important. A trigger cannot be created if an item it references is missing, so attempting to copy triggers first would have failed. Copying a trigger will not attempt to copy the items the trigger is referencing.

Follow these steps:

  1. Click on the Copy button at the bottom.
  2. In the next screen, choose Templates in the Target type drop-down and Custom templates in the Group drop-down.
  3. Mark the checkbox next to C_Template_Linux in the Target section, then click on Copy.

All triggers should be successfully copied. Of course, we don't have to create a host first; create entities on it, then copy them to a template. When creating a fresh template, you'll want to create entities on the template directly. If you have been less careful and haven't thought about templating beforehand, copying like this is a nice way to create the template more quickly.

..................Content has been hidden....................

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