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

3 嵌套

概述

Nesting is a way of one template encompassing one or more other templates.

嵌套是一种包含一个或多个其他模板的模板的方式

As it makes sense to separate out on individual templates entities for various services, applications etc. you may end up with quite a few templates all of which may need to be linked to quite a few hosts. To simplify the picture, it is possible to link some templates together, in one "nested" template.

因为将各个模板实体分离出来用于各种服务,应用程序等都是有意义的,所以您可能会得到相当多的模板,所有这些模板都可能需要链接到相当多的主机。为了简化图片,可以在一个“嵌套”模板中将一些模板链接在一起。

The benefit of nesting is that then you have to link only the one template to the host and the host will inherit all entities of the linked templates automatically.

嵌套的好处在于,您仅需将一个模板链接到主机,并且主机将自动继承链接的模板的所有实体。

配置嵌套模板

如果要链接一些模板,首先可以使用现有模板或新模板,然后:

  • 打开模板属性窗体
  • Look for the Linked templates tab
  • 查找链接的模板选项卡
  • Click on Select to select templates in the popup window
  • 单击选择以在弹出窗口中选择模板
  • Click on Add to list selected templates
  • 单击添加以列出所选模板
  • 单击模板属性窗体中的添加/更新

Now the template should have all the entities (items, triggers, custom graphs etc.) of the linked templates.

现在,模板应该具有所链接的模板的所有实体(监控项,触发器,自定义图表等)

To unlink any of the linked templates, in the same form use the Unlink or Unlink and clear buttons and click on Update.

要取消链接任何链接的模板,以相同的形式使用取消链接取消链接并清理按钮,然后单击更新

Choosing the Unlink option will simply remove the association with the other template, while not removing all its entities (items, triggers, graphs etc).

选择取消链接选项将简单地删除与其他模板的关联,而不删除其所有实体(监控项,触发器,图形等)

Choosing the Unlink and clear option will remove both the association with the other template and all its entities (items, triggers, graphs etc).

选择取消链接并清理选项将删除与其他模板及其所有实体(监控项,触发器,图表等)的关联。

权限问题

  • You may have a setup where an Admin level user has Read-write access to some Template A while not having Read-write access to Template B that holds Template A in a nested setup. In this case, an item created on Template A, while inherited by the hosts of Template A, will not be inherited by the hosts of Template B. Thus, creating a trigger for such an item will fail altogether, because of missing corresponding items on hosts of Template B.
* 
       * 您可以设置一个设置,其中一个管理级用户对某个模板A具有//读写//访问,而不具有//读写//访问模板B,该模板B在一个嵌套的设置中保存模板A。在这种情况下,在模板A上创建的项,而由模板A的宿主继承,**将不会**被模板B的主机继承,因此,创建这样一个项的触发器将完全失败,因为在模板B的主机上缺少相应的项。