Creating a template

Open Configuration | Templates. As we can see, there are already 38 predefined templates. 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
  • New group: Custom templates
Creating a template

The C_ at the front of the name stand 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 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 dropdown, then click on Items next to Another host. Mark all items by clicking in the checkbox in the header and click on the Copy button at the bottom.

Tip

Remember, 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.

In the next screen, choose Templates in the Target type dropdown and Custom templates in the Group dropdown. That leaves us with single entry, so mark the checkbox next to C_Template_Linux in the Target section:

Creating a template

When you are done, click on Copy. All items should be successfully copied.

Tip

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:

Creating a template

Now we have to do the same with triggers, so click on Triggers in the navigation bar above the item list, then click the checkbox in the header. This time 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.

Tip

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.

Again, click on the Copy button at the bottom. In the next screen, choose Templates in the Target type dropdown and Custom templates in the Group dropdown. 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.138.138.30