2022 Zabbix中国峰会
2022 Zabbix中国峰会

1 配置模板

概述

Configuring a template requires that you first create a template by defining its general parameters and then you add entities (items, triggers, graphs etc.) to it.

配置模板需要首先通过定义一些参数来创建模板,然后添加实体(项目,触发器,图形等)。

创建模板

To create a template, do the following:

要创建模板,请执行以下操作:

  • 转到配置→模板
  • 点击创建模板
  • 编辑模板属性

The Template tab contains general template attributes.

模板选项卡包含常规模板属性。

模板属性:

参数 描
模板名称 唯一的 板名称。
可见名称 如果你 置了这个名字,那么它将是列表,地图等中可见的。
群组 所属的主机/模板组。
新的群组 可以创 一个新组来保存模板。\\如果为空忽略。
主机/模板 应用模 的主机/模板列表。
描述 模板说明。

The Linked templates tab allows you to link one or more "nested" templates to this template. All entities (items, triggers, graphs etc.) will be inherited from the linked templates.

链接的模板选项卡允许您将一个或多个“嵌套”模板链接到此模板。所有实体(项目,触发器,图表等)将从链接的模板继承。

To link a new template, start typing in the Link new templates field until a list of templates corresponding to the entered letter(s) appear. Scroll down to select. When all templates to be linked are selected, click on Add.

要链接新的模板,请开始输入链接指示器字段,直到出现与输入的字母对应的模板列表。向下滚动选择。当选择要链接的所有模板时,单击添加

To unlink a template, use one of the two options in the Linked templates block:

要取消链接模板,请使用链接的模板模块中的两个选项之一:

  • 取消链接 - 取消链接模板,但保留其项目,触发器和图形
  • 取消链接并清理 - 取消链接模板并删除其所有项目,触发器和图形

The Macros tab allows you to define template-level user macros. You may also view here macros from linked templates and global macros if you select the Inherited and template macros option. That is where all defined user macros for the template are displayed with the value they resolve to as well as their origin.

选项卡允许您定义模板级用户宏。如果选择了继承模板的宏选项,则还可以从链接的模板和全局宏中查看宏。在这里,模板的所有定义的用户宏都显示了它们所决定的值以及它们的起源。

For convenience, links to respective templates and global macro configuration are provided. It is also possible to edit a nested template/global macro on the template level, effectively creating a copy of the macro on the template.

为方便起见,提供了相应模板和全局宏配置的链接。也可以在模板级别上编辑嵌套模板/全局宏,有效地创建模板上宏的副本。

按钮:

添加模板。添加的模板应该出现在列表中。
更新现有模板的属性。
根据当前模板的属性创建另一个模板,包括从链接模板继承的实体(项目,触发器等)
基于当前模板的属性创建另一个模板,包括从链接的模板继承并直接附加到当前模板的实体(项目,触发器等)。
删除模板; 模板(项目,触发器等)的实体与链接的主机保留。
从链接的主机中删除模板及其所有实体。
取消编辑模板属性。

With a template created, it is time to add some entities to it.

创建一个模板,开始添加一些实体。

Items have to be added to a template first. Triggers and graphs cannot be added without the corresponding item.

<note important>项目必须首先添加到模板中。如果没有相应的项目,则无法添加触发器和图形。 :::

添加监控项,触发器,图形

To add items to the template, do the following:

要向模板添监控项,请执行以下操作:

  • 转到配置→主机(或模板
  • Click on Items in the row of the required host/template
  • 单击所需主机/模板行中的监控项
  • Mark the checkboxes of items you want add to the template
  • 标记要添加到模板的项目的复选框
  • Click on Copy below the item list
  • 点击项目列表下面的复制
  • Select the template (or group of templates) the items should be copied to and click on Copy
  • 选择要复制的项目的模板(或模板组),然后单击复制

All the selected items should be copied to the template.

所有选定的监控项都应该被复制到模板中。

Adding triggers and graphs is done in similar fashion (from the list of triggers and graphs respectively), again, keeping in mind that they can only be added if the required items are added first.

添加触发器和图形以类似的方式完成(分别从触发器和图形列表),请记住,只有在首先添加所需项目时,才能添加它们。

添加聚合图形

To add screens to a template in Configuration → Templates, do the following:

要在配置→模板中向屏幕添加聚合图形,请执行以下操作:

  • Click on Screens in the row of the template
  • 点击模板行中的聚合图形
  • Configure a screen following the usual method of configuring screens
  • 按照通常的配置聚合图形的方法配置聚合图形

The elements that can be included in a template screen are: simple graph, custom graph, clock, plain text, URL.

<note important>可以包含在模板聚合图形中的元素有:简单图形,自定义图形,时钟,纯文本,URL。 :::

配置自动发现规则

See the low-level discovery section of the manual.

请参阅手册的自动发现现部分。

添加Web场景

To add web scenarios to a template in Configuration → Templates, do the following:

要将配置→模板中的 Web场景添加到模板,请执行以下操作: