5 实时导出协议

本节以换行符分隔的JSON格式显示实时导出协议的详细信息,用于:

所有文件均具有.ndjson扩展名。 导出文件的每一行都是一个JSON对象。

触发事件

针对问题事件导出以下信息:

字段类型描述
hosts数组触发器表达式中涉及的主机列表;数组中至少应包含一个元素。
-对象
host字符串主机名称。
name字符串可见的主机名称。
groups数组触发器表达式中涉及的所有主机的主机组列表; 数组中至少应包含一个元素。
-字符串主机组名称。
tags数组问题标签列表(可以为空)。
-对象
tag字符串标签名称。
value字符串标签值 (可以为空)。
name字符串问题事件名。
clock数字从周期开始到检测到问题的时间(整数部分)的秒数。
ns数字将纳秒添加到时钟以获取精确的问题检测时间。
eventid数字问题事件ID。
value数字1(通常)。

导出以下信息以进行恢复事件:

Field类型描述
clock数字从周期开始到问题解决为止的秒数(整数部分)。
ns数字将纳秒添加到添加到“时钟”以得到精确的问题解决时间。
eventid数字恢复事件ID。
p_eventid数字问题事件ID。
value数字0(通常)。
示例

问题:

  1. {"hosts":[{"host":"Host B", "name":"Host B visible"},{"host":"Zabbix Server","name":"Zabbix Server visible"}],"groups":["Group X","Group Y","Group Z","Zabbix servers"],"tags":[{"tag":"availability","value":""},{"tag":"data center","value":"Riga"}],"name":"Either Zabbix agent is unreachable on Host B or pollers are too busy on Zabbix Server","clock":1519304285,"ns":123456789,"eventid":42, "value":1}

恢复:

  1. {"clock":1519304345,"ns":987654321,"eventid":43,"p_eventid":42,"value":0}

问题(生成多个问题事件):

  1. {"hosts":[{"host":"Host B", "name":"Host B visible"},{"host":"Zabbix Server","name":"Zabbix Server visible"}],"groups":["Group X","Group Y","Group Z","Zabbix servers"],"tags":[{"tag":"availability","value":""},{"tag":"data center","value":"Riga"}],"name":"Either Zabbix agent is unreachable on Host B or pollers are too busy on Zabbix Server","clock":1519304286,"ns":123456789,"eventid":43, "value":1}
  1. {"hosts":[{"host":"Host B", "name":"Host B visible"},{"host":"Zabbix Server","name":"Zabbix Server visible"}],"groups":["Group X","Group Y","Group Z","Zabbix servers"],"tags":[{"tag":"availability","value":""},{"tag":"data center","value":"Riga"}],"name":"Either Zabbix agent is unreachable on Host B or pollers are too busy on Zabbix Server","clock":1519304286,"ns":123456789,"eventid":43, "value":1}

恢复:

  1. {"clock":1519304346,"ns":987654321,"eventid":44,"p_eventid":43,"value":0}
  1. {"clock":1519304346,"ns":987654321,"eventid":44,"p_eventid":42,"value":0}

监控项值

导出以下信息以收集项目值:

字段类型描述
host对象监控项主机的主机名称。
host字符串主机名称。
name字符串可见的主机名称。
groups数组监控项主机的主机组列表; 数组中至少应包含一个元素。
-字符串主机组名称。
applications数组项目应用列表; 如果没有,则为空。
-字符串应用名称。
itemid数字监控项ID。
name字符串可见的监控项名称。
clock数字从周期开始到值被收集为止的秒数(整数部分)。
ns数字将纳秒添加到“时钟”以获取精确的值收集时间。
timestamp
(仅日志)
数字0(如果不可用)。
source
(仅日志)
字符串空字符串(如果不可用)。
severity
(仅日志)
数字0(如果不可用)。
eventid
(仅日志)
数字0(如果不可用)。
value数字(对于数字)或\字符串(对于文本)收集监控项的值。
type数字收集的值类型:
0 - 浮点数, 1 - 字符, 2 - 日志, 3 - 无符号数字, 4 -文本
示例

数值(无符号):

  1. {"host":{"host":"Host B","name":"Host B visible"},"groups":["Group X","Group Y","Group Z"],"applications":["Zabbix Agent","Availability"],"itemid":3,"name":"Agent availability","clock":1519304285,"ns":123456789,"value":1,"type":3}

数值(浮点数):

  1. {"host":{"host":"Host B","name":"Host B visible"},"groups":["Group X","Group Y","Group Z"],"applications":["CPU","Performance"],"itemid":4,"name":"CPU Load","clock":1519304285,"ns":123456789,"value":"0.1","type":0}

字符, 文本:

  1. {"host":{"host":"Host B","name":"Host B visible"},"groups":["Group X","Group Y","Group Z"],"applications":["Zabbix Agent","Installed software versions"],"itemid":2,"name":"Agent version","clock":1519304285,"ns":123456789,"value":"3.4.4","type":4}

日志:

  1. {"host":{"host":"Host A","name":"Host A visible"},"groups":["Group X","Group Y","Group Z"],"applications":["Log files","Critical"],"itemid":1,"name":"Messages in log file","clock":1519304285,"ns":123456789,"timestamp":1519304285,"source":"","severity":0,"eventid":0,"value":"log file message","type":2}

趋势

导出以下信息以获取计算出的趋势值:

字段类型描述
host对象监控项主机的主机名称。
host字符串主机名称。
name字符串可见的主机名称。
groups数组监控项主机的主机组列表; 数组中至少应包含一个元素。
-字符串主机组名称。
applications数组项目应用列表; 如果没有,则为空。
-字符串应用名称。
itemid数字监控项ID。
name字符串可见的监控项名称。
clock数字从周期开始到值被收集为止的秒数(整数部分)。
count数字给定小时内收集的值的数量。
min数字给定小时内监控项的最小值。
avg数字给定小时内监控项的平均值。
max数字给定小时内监控项的最大值。
type数字值类型:
0-浮点数,3-无符号数字
示例

数值(无符号):

  1. {"host":{"host":"Host B","name":"Host B visible"},"groups":["Group X","Group Y","Group Z"],"applications":["Zabbix Agent","Availability"],"itemid":3,"name":"Agent availability","clock":1519311600,"count":60,"min":1,"avg":1,"max":1,"type":3}

数值(浮点数):

  1. {"host":{"host":"Host B","name":"Host B visible"},"groups":["Group X","Group Y","Group Z"],"applications":["CPU","Performance"],"itemid":4,"name":"CPU Load","clock":1519311600,"count":60,"min":0.01,"avg":0.15,"max":1.5,"type":0}