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

4 网络拓扑图

概述

网络拓扑图 导出(export) 包含:

  • 所有相关的图片
  • 拓扑图结构 - 所有拓扑图设置,所有包含元素及其设置,拓扑图链接和拓扑图链接状态指示器

未导出的是主机组,主机,触发器,其他拓扑图或可能与导出的拓扑图相关的任何其他元素。 因此,如果缺少拓扑图所引用的元素中的任何一个,导入将失败。

自Zabbix 1.8.2起支持网络拓扑图导出/导入。

导出

要导出网络拓扑图,请执行以下操作:

  • 切换到: 检测中(Monitoring)拓扑图(Maps)
  • 标记要导出的网络拓扑图的复选框
  • 单击列表下方的导出(Export)按钮

选中的拓扑图以默认名称 zabbix_export_maps.xml 导出到本地的XML文件里。

导入

要导入网络拓扑图,请执行以下操作:

  • 切换到: 监测中(Monitoring)拓扑图(Maps)
  • 点击右侧的导入(Import)按钮
  • 选择导入文件
  • 在导入规则中标记所需选项
  • 单击导入(Import)按钮

所有必填输入字段都标有红色星号。

导入成功或失败的消息将显示在前端。

导入规则:

规则 说
更新现有的(Update existing) 将使用从导入 件中获取的数据更新现有拓扑图。 否则他们将不会更新。
创建新的(Create new) 导入将使用 入文件中的数据添加新拓扑图。 否则它不会添加它们。

如果取消选中所有拓扑图选项并检查图像的相应选项,则仅导入图像。 图像导入仅适用于Zabbix Super Admin用户。

<note warning>如果替换现有图像,则会影响使用此图像的所有拓扑图。 :::

导出格式

导出一个包含三个元素的小型网络图,它们的图像和它们之间的一些链接。 请注意,图像被清空以节省空间。

<?xml version="1.0" encoding="UTF-8"?>
       <zabbix_export>
           <version>4.0</version>
           <date>2016-10-05T08:16:20Z</date>
           <images>
               <image>
                   <name>Server_(64)</name>
                   <imagetype>1</imagetype>
                   <encodedImage>iVBOR...SuQmCC</encodedImage>
               </image>
               <image>
                   <name>Workstation_(64)</name>
                   <imagetype>1</imagetype>
                   <encodedImage>iVBOR...SuQmCC</encodedImage>
               </image>
               <image>
                   <name>Zabbix_server_3D_(96)</name>
                   <imagetype>1</imagetype>
                   <encodedImage>iVBOR...ggg==</encodedImage>
               </image>
           </images>
           <maps>
               <map>
                   <name>Network</name>
                   <width>590</width>
                   <height>400</height>
                   <label_type>0</label_type>
                   <label_location>0</label_location>
                   <highlight>1</highlight>
                   <expandproblem>0</expandproblem>
                   <markelements>1</markelements>
                   <show_unack>0</show_unack>
                   <severity_min>2</severity_min>
                   <grid_size>40</grid_size>
                   <grid_show>1</grid_show>
                   <grid_align>1</grid_align>
                   <label_format>0</label_format>
                   <label_type_host>2</label_type_host>
                   <label_type_hostgroup>2</label_type_hostgroup>
                   <label_type_trigger>2</label_type_trigger>
                   <label_type_map>2</label_type_map>
                   <label_type_image>2</label_type_image>
                   <label_string_host/>
                   <label_string_hostgroup/>
                   <label_string_trigger/>
                   <label_string_map/>
                   <label_string_image/>
                   <expand_macros>0</expand_macros>
                   <background/>
                   <iconmap/>
                   <urls/>
                   <selements>
                       <selement>
                           <elementtype>0</elementtype>
                           <label>Host 1</label>
                           <label_location>-1</label_location>
                           <x>476</x>
                           <y>28</y>
                           <elementsubtype>0</elementsubtype>
                           <areatype>0</areatype>
                           <width>200</width>
                           <height>200</height>
                           <viewtype>0</viewtype>
                           <use_iconmap>0</use_iconmap>
                           <selementid>8</selementid>
                           <elements>
                               <element>
                                   <host>Discovered host</host>
                               </element>
                           </elements>
                           <icon_off>
                               <name>Server_(64)</name>
                           </icon_off>
                           <icon_on/>
                           <icon_disabled/>
                           <icon_maintenance/>
                           <application/>
                           <urls/>
                       </selement>
                       <selement>
                           <elementtype>0</elementtype>
                           <label>Zabbix server</label>
                           <label_location>-1</label_location>
                           <x>252</x>
                           <y>50</y>
                           <elementsubtype>0</elementsubtype>
                           <areatype>0</areatype>
                           <width>200</width>
                           <height>200</height>
                           <viewtype>0</viewtype>
                           <use_iconmap>0</use_iconmap>
                           <selementid>6</selementid>
                           <elements>
                               <element>
                                   <host>Zabbix server</host>
                               </element>
                           </elements>
                           <icon_off>
                               <name>Zabbix_server_3D_(96)</name>
                           </icon_off>
                           <icon_on/>
                           <icon_disabled/>
                           <icon_maintenance/>
                           <application/>
                           <urls/>
                       </selement>
                       <selement>
                           <elementtype>0</elementtype>
                           <label>New host</label>
                           <label_location>-1</label_location>
                           <x>308</x>
                           <y>230</y>
                           <elementsubtype>0</elementsubtype>
                           <areatype>0</areatype>
                           <width>200</width>
                           <height>200</height>
                           <viewtype>0</viewtype>
                           <use_iconmap>0</use_iconmap>
                           <selementid>7</selementid>
                           <elements>
                               <element>
                                   <host>Zabbix host</host>
                               </element>
                           </elements>
                           <icon_off>
                               <name>Workstation_(64)</name>
                           </icon_off>
                           <icon_on/>
                           <icon_disabled/>
                           <icon_maintenance/>
                           <application/>
                           <urls/>
                       </selement>
                   </selements>
                   <links>
                       <link>
                           <drawtype>0</drawtype>
                           <color>008800</color>
                           <label/>
                           <selementid1>6</selementid1>
                           <selementid2>8</selementid2>
                           <linktriggers/>
                       </link>
                       <link>
                           <drawtype>2</drawtype>
                           <color>00CC00</color>
                           <label>100MBps</label>
                           <selementid1>7</selementid1>
                           <selementid2>6</selementid2>
                           <linktriggers>
                               <linktrigger>
                                   <drawtype>0</drawtype>
                                   <color>DD0000</color>
                                   <trigger>
                                       <description>Zabbix agent on {HOST.NAME} is unreachable for 5 minutes</description>
                                       <expression>{Zabbix host:agent.ping.nodata(5m)}=1</expression>
                                       <recovery_expression/>
                                   </trigger>
                               </linktrigger>
                           </linktriggers>
                       </link>
                   </links>
               </map>
           </maps>
       </zabbix_export>

元素标签

元素标签值在下表中说明。

元素 元 属性 类型 范围 说明
images 图像的根元素。
image 单独的图像。
name 字符 图像名称。
imagetype 整型 1 - 图像  图像类2 - 背景
encodedImage Base64编码图像。
maps 拓扑图的根元素。
map 单独的拓扑图。
name 字符 拓扑图名称。
width 整型 图宽度,以像素为单位。
height 整型 图高度,以像素为单位。
label_type 整型 0 - 标签  拓扑图1 - 主机IP地址
2 - 元素名称
3 - 仅状态
4 - 无
素标签类型。
label_location 整型 0 - 底部  默认情1 - 左
2 - 右
3 - 顶部
下拓扑图元素标签位置。
highlight 整型 0 - no  为1 - yes 动触发器和主机状态启用图标突出显示。
expandproblem 整型 0 - no  显1 - yes 具有单个问题的元素的问题触发器。
markelements 整型 0 - no  突1 - yes 显示最近更改其状态的拓扑图元素。
show_unack 整型 0 - 所有问题的数量  问题显示。1 - 未确认问题的数量
2 - 分别统计已确认和未确认的问题
severity_min 整型 0 - 未分类  默认情况1 - 信息
2 - 警告
3 - 一般严重
4 - 严重
5 - 灾难
显示在拓扑图上的最小触发严重性。
grid_size 整型 2 , 40, 50, 75 或者 100 如果“ rid_show = 1”,这是拓扑图网格的单元格大小(以像素为单位)。
grid_show 整型 0 - yes  在1 - no 扑图配置中显示网格。
grid_align 整型 0 - yes  在1 - no 扑图配置中自动对齐图标。
label_format 整型 0 - no  使1 - yes 高级标签配置。
label_type_host 整型 0 - 标签  如果“1 - 主机IP地址
2 - 元素名称
3 - 仅状态
4 - 无
5 - 自定义标签
abel_format = 1”,则显示为主机标签。
label_type_hostgroup 整型 0 - 标签  如果“2 - 元素名称
3 - 仅状态
4 - 无
5 - 自定义标签
abel_format = 1”,则显示为主机组标签
label_type_trigger 整型 0 - 标签  如果“2 - 元素名称
3 - 仅状态
4 - 无
5 - 自定义标签
abel_format = 1”,则显示为触发器标签
label_type_map 整型 0 - 标签  如果“2 - 元素名称
3 - 仅状态
4 - 无
5 - 自定义标签
abel_format = 1”,则显示为拓扑图标签
label_type_image 整型 0 - 标签  显示为2 - 元素名称
4 - 无
5 - 自定义标签
像标签,如果“label_format = 1”
label_string_host 字符 “label_type_host = 5”,这是主机元素的自定义标签。
label_string_hostgroup 字符 “label_type_hostgroup = 5”,这是主机组元素的自定义标签。
label_string_trigger 字符 “label_type_trigger = 5”,这是触发元素的自定义标签。
label_string_map 字符 “label_type_map = 5”,则是拓扑图元素的自定义标签
label_string_image 字符 “label_type_image = 5”,则是图像元素的自定义标签
expand_macros 字符 0 - no  在1 - yes 扑图配置中展开标签中的宏。
background id 如果“imagetype = 2”,则是背景图像的ID(如果有)
iconmap id 图标映射的ID(如果有)。
urls
url 单独的URL。
name 字符 名称。
url 字符 URL。
elementtype 整型 0 - 主机  链接所1 - 拓扑图
2 - 触发器
3 - 主机组
4 - 图像
的拓扑图监控项类型。
selements
selement 单独的拓扑图元素
elementtype 整型 0 - 主机  拓扑图1 - 拓扑图
2 - 触发器
3 - 主机组
4 - 图像
素类型。
label 字符 标签。
label_location 整型 - - 使用拓扑图默认
0 - 底部
1 - 左
2 - 右
3 - 顶部
x 整型 X 上的位置。
y 整型 Y 上的位置。
elementsubtype 整型 0 - 单个主机组  如果“Ele1 - 所有主机组 entType=3”,则是元素子类型
areatype 整型 0 - 与整个拓扑图相同  如果“elemen1 - 自定义大小 subtype = 1”,则是区域大小
width 整型 “areatype = 1”,则是面积宽度
height 整型 “areatype = 1”,则是面积高度
viewtype 整型 0 - 均匀地放在该区域 如果“elemen subtype = 1”,则是区域放置算法
use_iconmap 整型 0 - no  使1 - yes 此元素的图标映射。 仅在拓扑图级别激活图标映射时才相关。
selementid id 唯一元素记录ID。
application 字符 集名称过滤器。 如果给出了应用集程序名称,则只会在拓扑图上显示属于给定应用集程序的触发器问题。
elements
element 在拓扑图上表示的单个Zabbix实体(拓扑图,主机组,主机等)。
host
icon_off 元素处于“正常”状态时使用的图像。
icon_on 元素处于“问题”状态时使用的图像。
icon_disabled 禁用元素时要使用的图像。
icon_maintenance 元素处于维护状态时使用的图像。
name 字符 的图像名称。
links
link 拓扑图元素之间的个别链接。
drawtype 整型 0 - 线条  线条类2 - 粗线条
3 - 虚线
4 - 中划线
color 字符 颜色(6个符号,十六进制)。
label 字符 标签。
selementid1 id 要连接的一个元素的ID。
selementid2 id 要连接的其他元素的ID。
linktriggers
linktrigger 单独的链接状态指示灯。
drawtype 整型 0 - 线条  触发器2 - 粗线条
3 - 虚线
4 - 中划线
于“问题”状态时的链接样式。
color 字符 发器处于“问题”状态时,链接颜色(6个符号,十六进制)。
trigger 触发器用于指示链路状态。
description 字符 器名称。
expression 字符 器表达式。
recovery_expression 字符 器恢复表达式。