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.
On the next screen, do the following:
- Choose Templates in the Target type drop-down, and Custom templates in the Group drop-down.
- That leaves us with single entry, so mark the checkbox next to C_Template_Linux in the Target section.
- 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:
- Click on Triggers in the navigation bar above the item list, then click the checkbox in the header next to Severity.
- 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.
Follow these steps:
- Click on the Copy button at the bottom.
- In the next screen, choose Templates in the Target type drop-down and Custom templates in the Group drop-down.
- 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.