5 实时导出协议

此部分描述 real-time export 协议以换行符分隔的JSON格式:

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

触发事件

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

FieldTypeDescription
hostsarrayList of hosts involved in the trigger expression; there should be at least one element in array.
-stringVisible host name.
groupsarraylist of host groups of all hosts involved in the trigger expression; there should be at least one element in array.
-stringHost group name.
tagsarrayList of problem tags (can be empty).
-object
tagstringTag name.
valuestringTag value (can be empty).
namestringProblem event name.
clocknumberNumber of seconds since Epoch to the moment when problem was detected (integer part).
nsnumberNumber of nanoseconds to be added to clock to get a precise problem detection time.
eventidnumberProblem event ID.
valuenumber1 (always).

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

FieldTypeDescription
clocknumberNumber of seconds since Epoch to the moment when problem was resolved (integer part).
nsnumberNumber of nanoseconds to be added to clock to get a precise problem resolution time.
eventidnumberRecovery event ID.
p_eventidnumberProblem event ID.
valuenumber0 (always).
例子

Problem:

  1. {"hosts":["Host B","Zabbix Server"],"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}

Recovery:

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

Problem (multiple problem event generation):

  1. {"hosts":["Host B","Zabbix Server"],"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}
  2. {"hosts":["Host B","Zabbix Server"],"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}

Recovery:

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

监控项值

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

FieldTypeDescription
hoststringVisible host name of the item host.
groupsarrayList of host groups of the item host; there should be at least one element in array.
-stringHost group name.
applicationsarrayList of the item applications; empty if there are none.
-stringApplication name.
itemidnumberItem ID.
namestringVisible item name.
clocknumberNumber of seconds since Epoch to the moment when value was collected (integer part).
nsnumberNumber of nanoseconds to be added to clock to get a precise value collection time.
timestamp
(Log only)
number0 if not available.
source
(Log only)
stringEmpty string if not available.
severity
(Log only)
number0 if not available.
logeventid
(Log only)
number0 if not available.
valuenumber (for numeric items) or
string (for text items)
Collected item value.
例子

Numeric (unsigned) value:

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

Numeric (float) value:

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

Character, text value:

  1. {"host":"Host B","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"}

Log value:

  1. {"host":"Host A","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,"logeventid":0,"value":"log file message"}

趋势

将为计算的趋势值导出以下信息:

FieldTypeDescription
hoststringVisible host name of the item host.
groupsarrayList of host groups of the item host; there should be at least one element in array.
-stringHost group name.
applicationsarrayList of the item applications; empty if there are none.
-stringApplication name.
itemidnumberItem ID.
namestringVisible item name.
clocknumberNumber of seconds since Epoch to the moment when value was collected (integer part).
countnumberNumber of values collected for a given hour.
minnumberMinimum item value for a given hour.
avgnumberAverage item value for a given hour.
maxnumberMaximum item value for a given hour.
例子

Numeric (unsigned) value:

  1. {"host":"Host B","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}

Numeric (float) value:

  1. {"host":"Host B","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}

5 Real-time export protocol

This section presents details of the real-time export protocol in a newline-delimited JSON format for:

All files have a .ndjson extension. Each line of the export file is a JSON object.

Trigger events

The following information is exported for a problem event:

FieldTypeDescription
hostsarrayList of hosts involved in the trigger expression; there should be at least one element in array.
-stringVisible host name.
groupsarraylist of host groups of all hosts involved in the trigger expression; there should be at least one element in array.
-stringHost group name.
tagsarrayList of problem tags (can be empty).
-object
tagstringTag name.
valuestringTag value (can be empty).
namestringProblem event name.
clocknumberNumber of seconds since Epoch to the moment when problem was detected (integer part).
nsnumberNumber of nanoseconds to be added to clock to get a precise problem detection time.
eventidnumberProblem event ID.
valuenumber1 (always).

The following information is exported for a recovery event:

FieldTypeDescription
clocknumberNumber of seconds since Epoch to the moment when problem was resolved (integer part).
nsnumberNumber of nanoseconds to be added to clock to get a precise problem resolution time.
eventidnumberRecovery event ID.
p_eventidnumberProblem event ID.
valuenumber0 (always).
Examples

Problem:

  1. {"hosts":["Host B","Zabbix Server"],"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}

Recovery:

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

Problem (multiple problem event generation):

  1. {"hosts":["Host B","Zabbix Server"],"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}
  2. {"hosts":["Host B","Zabbix Server"],"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}

Recovery:

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

Item values

The following information is exported for a collected item value:

FieldTypeDescription
hoststringVisible host name of the item host.
groupsarrayList of host groups of the item host; there should be at least one element in array.
-stringHost group name.
applicationsarrayList of the item applications; empty if there are none.
-stringApplication name.
itemidnumberItem ID.
namestringVisible item name.
clocknumberNumber of seconds since Epoch to the moment when value was collected (integer part).
nsnumberNumber of nanoseconds to be added to clock to get a precise value collection time.
timestamp
(Log only)
number0 if not available.
source
(Log only)
stringEmpty string if not available.
severity
(Log only)
number0 if not available.
logeventid
(Log only)
number0 if not available.
valuenumber (for numeric items) or
string (for text items)
Collected item value.
Examples

Numeric (unsigned) value:

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

Numeric (float) value:

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

Character, text value:

  1. {"host":"Host B","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"}

Log value:

  1. {"host":"Host A","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,"logeventid":0,"value":"log file message"}

The following information is exported for a calculated trend value:

FieldTypeDescription
hoststringVisible host name of the item host.
groupsarrayList of host groups of the item host; there should be at least one element in array.
-stringHost group name.
applicationsarrayList of the item applications; empty if there are none.
-stringApplication name.
itemidnumberItem ID.
namestringVisible item name.
clocknumberNumber of seconds since Epoch to the moment when value was collected (integer part).
countnumberNumber of values collected for a given hour.
minnumberMinimum item value for a given hour.
avgnumberAverage item value for a given hour.
maxnumberMaximum item value for a given hour.
Examples

Numeric (unsigned) value:

  1. {"host":"Host B","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}

Numeric (float) value:

  1. {"host":"Host B","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}