7 模板


A template is a set of entities that can be conveniently applied to multiple hosts. 模板是可以方便地应用于多个主机的一组实体。

The entities may be: 实体可以是:

  • items
  • 监控项
  • triggers
  • 触发器
  • graphs
  • 图形
  • applications
  • 应用
  • screens (since Zabbix 2.0)
  • 聚合图形(自Zabbix 2.0起
  • low-level discovery rules (since Zabbix 2.0)
  • 自动发现规则 (自Zabbix 2.0起)
  • web scenarios (since Zabbix 2.2)
  • web场景 (自Zabbix 2.0起)

As many hosts in real life are identical or fairly similar so it naturally follows that the set of entities (items, triggers, graphs,…) you have created for one host, may be useful for many. Of course, you could copy them to each new host, but that would be a lot of manual work. Instead, with templates you can copy them to one template and then apply the template to as many hosts as needed. 由于现实生活中的许多主机是相同或类似的,所以,您为一个主机创建的一组实体(项目,触发器,图形,…)可能对许多人有用。当然,您可以将它们复制到每个新的主机上,但需要费很大功夫。相反,使用模板,您可以将它们复制到一个模板,然后根据需要将模板应用于尽可能多的主机。

When a template is linked to a host, all entities (items, triggers, graphs,…) of the template are added to the host. Templates are assigned to each individual host directly (and not to a host group). 当模板链接到主机时,模板的所有实体(项目,触发器,图形,…)都将添加到主机。模板直接分配给每个单独的主机(而不是主机组)。

Templates are often used to group entities for particular services or applications (like Apache, MySQL, PostgreSQL, Postfix…) and then applied to hosts running those services. 模板通常用于为特定服务或应用程序(如Apache,MySQL,PostgreSQL,Postfix …)分组实体,然后应用于运行这些服务的主机。

Another benefit of using templates is when something has to be changed for all the hosts. Changing something on the template level once will propagate the change to all the linked hosts. 使用模板的另一个好处是当所有主机都需要更改时。只需要在模板上更改某些内容将会将更改应用到所有链接的主机。

Thus, the use of templates is an excellent way of reducing one's workload and streamlining the Zabbix configuration. 因此,使用模板是减少工作量并简化Zabbix配置的好方法。

Proceed to creating and configuring a template. 继续创建和配置模板