5 实时导出协议

本节以 JSON 格式提供real-time export协议的详细信息:

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

触发器事件

为问题事件导出以下信息:

字段类型描述
clocknumber检测到问题的那一刻的时间秒数(整数部分)
nsnumber要添加到clock以获得精确问题检测时间的纳秒数。
valuenumber1 (always).
eventidnumber问题事件ID.
namestring问题时间名称.
severitynumber问题事件严重性 (0 - 未分类, 1 - 信息, 2 - 警告, 3 - 一般严重, 4 - 严重, 5 - 灾难).
hostsarray触发器表达式中涉及的主机列表;数组中应至少有一个元素。
-object
hoststring主机名.
namestring可见主机名
groupsarray触发器表达式中涉及的所有主机的主机组列表;数组中应至少有一个元素.
-string主机组名称.
tagsarray问题TAG列表(可以为空).
-object
tagstringTag 名称.
valuestringTag 值(可以为空).

为恢复事件导出以下信息:

字段类型描述
clocknumber问题恢复那一刻的时间秒数(整数部分).
nsnumber要添加到clock以获得精确问题恢复时间的纳秒数。
valuenumber0 (总是).
eventidnumber恢复事件ID.
p_eventidnumber问题事件ID.

问题:

  1. {"clock":1519304285,"ns":123456789,"value":1,"name":"Either Zabbix agent is unreachable on Host B or pollers are too busy on Zabbix Server","severity":3,"eventid":42, "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"}]}

恢复:

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

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

  1. {"clock":1519304286,"ns":123456789,"value":1,"eventid":43,"name":"Either Zabbix agent is unreachable on Host B or pollers are too busy on Zabbix Server","severity":3,"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"}]}
  2. {"clock":1519304286,"ns":123456789,"value":1,"eventid":43,"name":"Either Zabbix agent is unreachable on Host B or pollers are too busy on Zabbix Server","severity":3,"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"}]}

恢复:

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

监控项值

为收集的监控项值导出以下信息:

字段类型描述
hostobject监控项主机的主机名.
hoststring主机名.
namestring可见的主机名.
groupsarray监控项主机的主机组列表;数组中应至少有一个元素
-string主机组名.
itemidnumber监控项 ID.
namestring可见监控项名称.
clocknumber收集值那一刻的时间秒数(整数部分).
nsnumber要添加到clock以获得精确收集值时间的纳秒数。
timestamp
(Log only)
number如果不可用,则为 0
source
(Log only)
string如果不可用,则为空字符串
severity
(Log only)
number如果不可用,则为 0
eventid
(Log only)
number如果不可用,则为 0
valuenumber (for numeric items) or
string (for text items)
收集的监控项值。
typenumber收集的值类型:
0 - 浮点数, 1 - 字符, 2 - 日志, 3 - 无符号数字, 4 -文本

数值(无符号):

  1. {"host":{"host":"Host B","name":"Host B visible"},"groups":["Group X","Group Y","Group Z"],"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"],"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"],"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"],"itemid":1,"name":"Messages in log file","clock":1519304285,"ns":123456789,"timestamp":1519304285,"source":"","severity":0,"eventid":0,"value":"log file message","type":2}

趋势

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

FieldTypeDescription
hostobject监控项主机的主机名
hoststring主机名
namestring可见的主机名.
groupsarray监控项主机的主机组列表;数组中应至少有一个元素
-string主机组名.
itemidnumber监控项ID.
namestring可见监控项名称.
clocknumber收集值那一刻的时间秒数(整数部分).
countnumber一小时内收集的值的数量。
minnumber一小时内最小监控项值
avgnumber一小时内平均监控项值
maxnumber一小时内最大监控项值
typenumber值类型:
0 - 浮点数, 3 - 无符号数字

数值(无符号):

  1. {"host":{"host":"Host B","name":"Host B visible"},"groups":["Group X","Group Y","Group Z"],"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"],"itemid":4,"name":"CPU Load","clock":1519311600,"count":60,"min":0.01,"avg":0.15,"max":1.5,"type":0}