1 Server-proxy 数据交换协议

概述

Server-proxy 数据交换基于JSON格式。

请求和响应消息必须以header and data length开头

被动代理

代理配置请求

proxy config 请求由服务器发送以提供代理配置数据。 每次发送此请求 ProxyConfigFrequency (服务器配置参数)秒。

name value type description
server→proxy:
request string 'proxy config'
<table> object one or more objects with <table> data
fields array array of field names
- string field name
data array array of rows
- array array of columns
- string,number column value with type depending on column type in database schema
proxy→server:
response string the request success information ('success' or 'failed')
version string the proxy version (<major>.<minor>.<build>)

例:

server→proxy:

{
           "request": "proxy config",
           "globalmacro":{
               "fields":[
                   "globalmacroid",
                   "macro",
                   "value"
               ],
               "data":[
                   [
                       2,
                       "{$SNMP_COMMUNITY}",
                       "public"
                   ]
               ]
           },
           "hosts":{
               "fields":[
                   "hostid",
                   "host",
                   "status",
                   "ipmi_authtype",
                   "ipmi_privilege",
                   "ipmi_username",
                   "ipmi_password",
                   "name",
                   "tls_connect",
                   "tls_accept",
                   "tls_issuer",
                   "tls_subject",
                   "tls_psk_identity",
                   "tls_psk"
               ],
               "data":[
                   [
                       10001,
                       "Template OS Linux",
                       3,
                       -1,
                       2,
                       "",
                       "",
                       "Template OS Linux",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ],
                   [
                       10050,
                       "Template App Zabbix Agent",
                       3,
                       -1,
                       2,
                       "",
                       "",
                       "Template App Zabbix Agent",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ],
                   [
                       10105,
                       "Logger",
                       0,
                       -1,
                       2,
                       "",
                       "",
                       "Logger",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ]
               ]
           },
           "interface":{
               "fields":[
                   "interfaceid",
                   "hostid",
                   "main",
                   "type",
                   "useip",
                   "ip",
                   "dns",
                   "port",
                   "bulk"
               ],
               "data":[
                   [
                       2,
                       10105,
                       1,
                       1,
                       1,
                       "127.0.0.1",
                       "",
                       "10050",
                       1
                   ]
               ]
           },
           ...
       }

proxy→server:

{
         "response": "success",
         "version": "3.4.0"
       }
代理请求

proxy data request用于从代理获取主机可用性,历史,发现和自动注册数据。 每次发送此请求 ProxyDataFrequency (服务器配置参数)秒。

name value type description
server→proxy:
request string 'proxy data'
proxy→server:
host availability array (optional) array of host availability data objects
hostid number host identifier
available number Zabbix agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
error string Zabbix agent error message or empty string
snmp_available number SNMP agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
snmp_error string SNMP agent error message or empty string
ipmi_available number IPMI agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
ipmi_error string IPMI agent error message or empty string
jmx_available number JMX agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
jmx_error string JMX agent error message or empty string
history data array (optional) array of history data objects
itemid number item identifier
clock number item value timestamp (seconds)
ns number item value timestamp (nanoseconds)
value string (optional) item value
timestamp number (optional) timestamp of log type items
source string (optional) eventlog item source value
severity number (optional) eventlog item severity value
eventid number (optional) eventlog item eventid value
state string (optional) item state
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsize number (optional) last logs ize of log type items
mtime number (optional) modify time of log type items
discovery data array (optional) array of discovery data objects
clock number the discovery data timestamp
druleid number the discovery rule identifier
dcheckid number the discovery check indentifier or null for discovery rule data
type number the discovery check type:

-1 discovery rule data
0, SVC_SSH - SSH service check
1, SVC_LDAP - LDAP service check
2, SVC_SMTP - SMTP service check
3, SVC_FTP - FTP service check
4, SVC_HTTP - HTTP service check
5, SVC_POP - POP service check
6, SVC_NNTP - NNTP service check
7, SVC_IMAP - IMAP service check
8, SVC_TCP - TCP port availability check
9, SVC_AGENT - Zabbix agent
10, SVC_SNMPv1 - SNMPv1 agent
11, SVC_SNMPv2 - SNMPv2 agent
12, SVC_ICMPPING - ICMP ping
13, SVC_SNMPv3 - SNMPv3 agent
14, SVC_HTTPS - HTTPS service check
15, SVC_TELNET - Telnet availability check
ip string the host IP address
dns string the host DNS name
port number (optional) service port number
key_ string (optional) the item key for discovery check of type 9 SVC_AGENT
value string (optional) value received from the service, can be empty for most of services
status number (optional) service status:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registration array (optional) array of auto registration data objects
clock number the auto registration data timestamp
host string the host name
ip string (optional) the host IP address
dns string (optional) the resolved DNS name from IP address
port string (optional) the host port
host_metadata string (optional) the host metadata sent by agent (based on HostMetadata or HostMetadataItem agent configuration parameter)
tasks array (optional) array of tasks
type number the task type:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - remote command result
status number the remote command execution status:

0, ZBX_TM_REMOTE_COMMAND_COMPLETED - the remote command completed successfully
1, ZBX_TM_REMOTE_COMMAND_FAILED - the remote command failed
error string (optional) the error message
parent_taskid number the parent task id
more number (optional) 1 - there are more history data to send
clock number data transfer timestamp (seconds)
ns number data transfer timestamp (nanoseconds)
version string the proxy version (<major>.<minor>.<build>)
server→proxy:
response string the request success information ('success' or 'failed')
tasks array (optional) array of tasks
type number the task type:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - remote command
clock number the task creation time
ttl number the time in seconds after which task expires
commandtype number the remote command type:

0, ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT - use custom script
1, ZBX_SCRIPT_TYPE_IPMI - use IPMI
2, ZBX_SCRIPT_TYPE_SSH - use SSH
3, ZBX_SCRIPT_TYPE_TELNET - use Telnet
4, ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT - use global script (currently functionally equivalent to custom script)
command string the remote command to execute
execute_on number the execution target for custom scripts:

0, ZBX_SCRIPT_EXECUTE_ON_AGENT - execute script on agent
1, ZBX_SCRIPT_EXECUTE_ON_SERVER - execute script on server
2, ZBX_SCRIPT_EXECUTE_ON_PROXY - execute script on proxy
port number (optional) the port for telnet and ssh commands
authtype number (optional) the authentication type for ssh commands
username string (optional) the user name for telnet and ssh commands
password string (optional) the password for telnet and ssh commands
publickey string (optional) the public key for ssh commands
privatekey string (optional) the private key for ssh commands
parent_taskid number the parent task id
hostid number target hostid

例如:

server→proxy:

{
         "request": "proxy data"
       }

proxy→server:

{
           "host availability":[
               {
                   "hostid":10106,
                   "available":1,
                   "error":"",
                   "snmp_available":0,
                   "snmp_error":"",
                   "ipmi_available":0,
                   "ipmi_error":"",
                   "jmx_available":0,
                   "jmx_error":""
               },
               {
                   "hostid":10107,
                   "available":1,
                   "error":"",
                   "snmp_available":0,
                   "snmp_error":"",
                   "ipmi_available":0,
                   "ipmi_error":"",
                   "jmx_available":0,
                   "jmx_error":""
               }
           ],
           "history data":[
               {
                   "itemid":"12345",
                   "clock":1478609647,
                   "ns":332510044,
                   "value":"52956612"
               },
               {
                   "itemid":"12346",
                   "clock":1478609647,
                   "ns":330690279,
                   "state":1,
                   "value":"Cannot find information for this network interface in /proc/net/dev."
               }
           ],
           "discovery data":[
               {
                   "clock":1478608764,
                   "drule":2,
                   "dcheck":3,
                   "type":12,
                   "ip":"10.3.0.10",
                   "dns":"vdebian",
                   "status":1
               },
               {
                   "clock":1478608764,
                   "drule":2,
                   "dcheck":null,
                   "type":-1,
                   "ip":"10.3.0.10",
                   "dns":"vdebian",
                   "status":1
               }
           ],
           "auto registration":[
               {
                   "clock":1478608371,
                   "host":"Logger1",
                   "ip":"10.3.0.1",
                   "dns":"localhost",
                   "port":"10050"
               },
               {
                   "clock":1478608381,
                   "host":"Logger2",
                   "ip":"10.3.0.2",
                   "dns":"localhost",
                   "port":"10050"
               }
           ],
           "tasks":[
               {
                   "type": 0,
                   "status": 0,
                   "parent_taskid": 10
               },
               {
                   "type": 0,
                   "status": 1,
                   "error": "No permissions to execute task.",
                   "parent_taskid": 20
               }
           ],    
           "clock":1478609648,
           "ns":157729208,
           "version":"3.4.0"
       }

server→proxy:

{
         "response": "success",
         "tasks":[
             {
                "type": 1,
                "clock": 1478608371,
                "ttl": 600,
                "commandtype": 2,
                "command": "restart_service1.sh",
                "execute_on": 2,
                "port": 80,
                "authtype": 0,
                "username": "userA",
                "password": "password1",
                "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
                "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
                "parent_taskid": 10,
                "hostid": 10070
             },
             {
                "type": 1,
                "clock": 1478608381,
                "ttl": 600,
                "commandtype": 1,
                "command": "restart_service2.sh",
                "execute_on": 0,
                "authtype": 0,
                "username": "",
                "password": "",
                "publickey": "",
                "privatekey": "",
                "parent_taskid": 20,
                "hostid": 10084
             }
         ]
       }

主动代理

代理心跳请求

proxy heartbeat 请求由代理发送以报告代理正在运行。 每次发送此请求 HeartbeatFrequency (代理配置参数)秒。

name value type description
proxy→server:
request string 'proxy heartbeat'
host string the proxy name
version string the proxy version (<major>.<minor>.<build>)
server→proxy:
response string the request success information ('success' or 'failed')

proxy→server:

{
          "request": "proxy heartbeat",
          "host": "Proxy #12",
          "version": "3.4.0"
       }

server→proxy:

{
         "response": "success"
       }
代理配置请求

proxy config 请求由代理发送以获取代理配置数据。 每次发送此请求 ConfigFrequency (代理配置参数)秒。

name value type description
proxy→server:
request string 'proxy config'
host string proxy name
version string the proxy version (<major>.<minor>.<build>)
server→proxy:
request string 'proxy config'
<table> object one or more objects with <table> data
fields array array of field names
- string field name
data array array of rows
- array array of columns
- string,number column value with type depending on column type in database schema
proxy→server:
response string the request success information ('success' or 'failed')

Example:

proxy→server:

{
         "request": "proxy config",
         "host": "Proxy #12",
         "version":"3.4.0"
       }

server→proxy:

{
           "globalmacro":{
               "fields":[
                   "globalmacroid",
                   "macro",
                   "value"
               ],
               "data":[
                   [
                       2,
                       "{$SNMP_COMMUNITY}",
                       "public"
                   ]
               ]
           },
           "hosts":{
               "fields":[
                   "hostid",
                   "host",
                   "status",
                   "ipmi_authtype",
                   "ipmi_privilege",
                   "ipmi_username",
                   "ipmi_password",
                   "name",
                   "tls_connect",
                   "tls_accept",
                   "tls_issuer",
                   "tls_subject",
                   "tls_psk_identity",
                   "tls_psk"
               ],
               "data":[
                   [
                       10001,
                       "Template OS Linux",
                       3,
                       -1,
                       2,
                       "",
                       "",
                       "Template OS Linux",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ],
                   [
                       10050,
                       "Template App Zabbix Agent",
                       3,
                       -1,
                       2,
                       "",
                       "",
                       "Template App Zabbix Agent",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ],
                   [
                       10105,
                       "Logger",
                       0,
                       -1,
                       2,
                       "",
                       "",
                       "Logger",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ]
               ]
           },
           "interface":{
               "fields":[
                   "interfaceid",
                   "hostid",
                   "main",
                   "type",
                   "useip",
                   "ip",
                   "dns",
                   "port",
                   "bulk"
               ],
               "data":[
                   [
                       2,
                       10105,
                       1,
                       1,
                       1,
                       "127.0.0.1",
                       "",
                       "10050",
                       1
                   ]
               ]
           },
           ...
       }

proxy→server:

{
         "response": "success"
       }
代理数据请求

proxy data 请求由代理发送,以提供主机可用性,历史记录,发现和自动注册数据。 每次发送此请求 DataSenderFrequency (代理配置参数)秒。

name value type description
proxy→server:
request string 'proxy data'
host string the proxy name
host availability array (optional) array of host availability data objects
hostid number host identifier
available number Zabbix agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
error string Zabbix agent error message or empty string
snmp_available number SNMP agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
snmp_error string SNMP agent error message or empty string
ipmi_available number IPMI agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
ipmi_error string IPMI agent error message or empty string
jmx_available number JMX agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
jmx_error string JMX agent error message or empty string
history data array (optional) array of history data objects
itemid number item identifier
clock number item value timestamp (seconds)
ns number item value timestamp (nanoseconds)
value string (optional) item value
timestamp number (optional) timestamp of log type items
source string (optional) eventlog item source value
severity number (optional) eventlog item severity value
eventid number (optional) eventlog item eventid value
state string (optional) item state
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsize number (optional) last logs ize of log type items
mtime number (optional) modify time of log type items
discovery data array (optional) array of discovery data objects
clock number the discovery data timestamp
druleid number the discovery rule identifier
dcheckid number the discovery check indentifier or null for discovery rule data
type number the discovery check type:

-1 discovery rule data
0, SVC_SSH - SSH service check
1, SVC_LDAP - LDAP service check
2, SVC_SMTP - SMTP service check
3, SVC_FTP - FTP service check
4, SVC_HTTP - HTTP service check
5, SVC_POP - POP service check
6, SVC_NNTP - NNTP service check
7, SVC_IMAP - IMAP service check
8, SVC_TCP - TCP port availability check
9, SVC_AGENT - Zabbix agent
10, SVC_SNMPv1 - SNMPv1 agent
11, SVC_SNMPv2 - SNMPv2 agent
12, SVC_ICMPPING - ICMP ping
13, SVC_SNMPv3 - SNMPv3 agent
14, SVC_HTTPS - HTTPS service check
15, SVC_TELNET - Telnet availability check
ip string the host IP address
dns string the host DNS name
port number (optional) service port number
key_ string (optional) the item key for discovery check of type 9 SVC_AGENT
value string (optional) value received from the service, can be empty for most of services
status number (optional) service status:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registration array (optional) array of auto registration data objects
clock number the auto registration data timestamp
host string the host name
ip string (optional) the host IP address
dns string (optional) the resolved DNS name from IP address
port string (optional) the host port
host_metadata string (optional) the host metadata sent by agent (based on HostMetadata or HostMetadataItem agent configuration parameter)
tasks array (optional) array of tasks
type number the task type:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - remote command result
status number the remote command execution status:

0, ZBX_TM_REMOTE_COMMAND_COMPLETED - the remote command completed successfully
1, ZBX_TM_REMOTE_COMMAND_FAILED - the remote command failed
error string (optional) the error message
parent_taskid number the parent task id
more number (optional) 1 - there are more history data to send
clock number data transfer timestamp (seconds)
ns number data transfer timestamp (nanoseconds)
version string the proxy version (<major>.<minor>.<build>)
server→proxy:
response string the request success information ('success' or 'failed')
tasks array (optional) array of tasks
type number the task type:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - remote command
clock number the task creation time
ttl number the time in seconds after which task expires
commandtype number the remote command type:

0, ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT - use custom script
1, ZBX_SCRIPT_TYPE_IPMI - use IPMI
2, ZBX_SCRIPT_TYPE_SSH - use SSH
3, ZBX_SCRIPT_TYPE_TELNET - use Telnet
4, ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT - use global script (currently functionally equivalent to custom script)
command string the remote command to execute
execute_on number the execution target for custom scripts:

0, ZBX_SCRIPT_EXECUTE_ON_AGENT - execute script on agent
1, ZBX_SCRIPT_EXECUTE_ON_SERVER - execute script on server
2, ZBX_SCRIPT_EXECUTE_ON_PROXY - execute script on proxy
port number (optional) the port for telnet and ssh commands
authtype number (optional) the authentication type for ssh commands
username string (optional) the user name for telnet and ssh commands
password string (optional) the password for telnet and ssh commands
publickey string (optional) the public key for ssh commands
privatekey string (optional) the private key for ssh commands
parent_taskid number the parent task id
hostid number target hostid

例如:

proxy→server:

{
         "request": "proxy data",
         "host": "Proxy #12", 
           "host availability":[
               {
                   "hostid":10106,
                   "available":1,
                   "error":"",
                   "snmp_available":0,
                   "snmp_error":"",
                   "ipmi_available":0,
                   "ipmi_error":"",
                   "jmx_available":0,
                   "jmx_error":""
               },
               {
                   "hostid":10107,
                   "available":1,
                   "error":"",
                   "snmp_available":0,
                   "snmp_error":"",
                   "ipmi_available":0,
                   "ipmi_error":"",
                   "jmx_available":0,
                   "jmx_error":""
               }
           ],
           "history data":[
               {
                   "itemid":"12345",
                   "clock":1478609647,
                   "ns":332510044,
                   "value":"52956612"
               },
               {
                   "itemid":"12346",
                   "clock":1478609647,
                   "ns":330690279,
                   "state":1,
                   "value":"Cannot find information for this network interface in /proc/net/dev."
               }
           ],
           "discovery data":[
               {
                   "clock":1478608764,
                   "drule":2,
                   "dcheck":3,
                   "type":12,
                   "ip":"10.3.0.10",
                   "dns":"vdebian",
                   "status":1
               },
               {
                   "clock":1478608764,
                   "drule":2,
                   "dcheck":null,
                   "type":-1,
                   "ip":"10.3.0.10",
                   "dns":"vdebian",
                   "status":1
               }
           ],
           "auto registration":[
               {
                   "clock":1478608371,
                   "host":"Logger1",
                   "ip":"10.3.0.1",
                   "dns":"localhost",
                   "port":"10050"
               },
               {
                   "clock":1478608381,
                   "host":"Logger2",
                   "ip":"10.3.0.2",
                   "dns":"localhost",
                   "port":"10050"
               }
           ],
           "tasks":[
               {
                   "type": 2,
                   "clock":1478608371,
                   "ttl": 600,
                   "commandtype": 2,
                   "command": "restart_service1.sh",
                   "execute_on": 2,
                   "port": 80,
                   "authtype": 0,
                   "username": "userA",
                   "password": "password1",
                   "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
                   "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
                   "parent_taskid": 10,
                   "hostid": 10070
               },
               {
                   "type": 2,
                   "clock":1478608381,
                   "ttl": 600,
                   "commandtype": 1,
                   "command": "restart_service2.sh",
                   "execute_on": 0,
                   "authtype": 0,
                   "username": "",
                   "password": "",
                   "publickey": "",
                   "privatekey": "",
                   "parent_taskid": 20,
                   "hostid": 10084
               }
           ],
           "tasks":[
               {
                   "type": 0,
                   "status": 0,
                   "parent_taskid": 10
               },
               {
                   "type": 0,
                   "status": 1,
                   "error": "No permissions to execute task.",
                   "parent_taskid": 20
               }
           ], 
           "clock":1478609648,
           "ns":157729208,
           "version":"3.4.0"
       }

server→proxy:

{
         "response": "success",
         "tasks":[
             {
                "type": 1,
                "clock": 1478608371,
                "ttl": 600,
                "commandtype": 2,
                "command": "restart_service1.sh",
                "execute_on": 2,
                "port": 80,
                "authtype": 0,
                "username": "userA",
                "password": "password1",
                "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
                "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
                "parent_taskid": 10,
                "hostid": 10070
             },
             {
                "type": 1,
                "clock": 1478608381,
                "ttl": 600,
                "commandtype": 1,
                "command": "restart_service2.sh",
                "execute_on": 0,
                "authtype": 0,
                "username": "",
                "password": "",
                "publickey": "",
                "privatekey": "",
                "parent_taskid": 20,
                "hostid": 10084
             }
         ]
       }

向后兼容性

服务器通过接受旧的支持部分向后兼容 host availability, history data, discovery data and auto registration 请求.

1 Server-proxy data exchange protocol

Overview

Server - proxy data exchange is based on JSON format.

Request and response messages must begin with header and data length.

Passive proxy

Proxy config request

The proxy config request is sent by server to provide proxy configuration data. This request is sent every ProxyConfigFrequency (server configuration parameter) seconds.

name value type description
server→proxy:
request string 'proxy config'
<table> object one or more objects with <table> data
fields array array of field names
- string field name
data array array of rows
- array array of columns
- string,number column value with type depending on column type in database schema
proxy→server:
response string the request success information ('success' or 'failed')
version string the proxy version (<major>.<minor>.<build>)

Example:

server→proxy:

{
           "request": "proxy config",
           "globalmacro":{
               "fields":[
                   "globalmacroid",
                   "macro",
                   "value"
               ],
               "data":[
                   [
                       2,
                       "{$SNMP_COMMUNITY}",
                       "public"
                   ]
               ]
           },
           "hosts":{
               "fields":[
                   "hostid",
                   "host",
                   "status",
                   "ipmi_authtype",
                   "ipmi_privilege",
                   "ipmi_username",
                   "ipmi_password",
                   "name",
                   "tls_connect",
                   "tls_accept",
                   "tls_issuer",
                   "tls_subject",
                   "tls_psk_identity",
                   "tls_psk"
               ],
               "data":[
                   [
                       10001,
                       "Template OS Linux",
                       3,
                       -1,
                       2,
                       "",
                       "",
                       "Template OS Linux",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ],
                   [
                       10050,
                       "Template App Zabbix Agent",
                       3,
                       -1,
                       2,
                       "",
                       "",
                       "Template App Zabbix Agent",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ],
                   [
                       10105,
                       "Logger",
                       0,
                       -1,
                       2,
                       "",
                       "",
                       "Logger",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ]
               ]
           },
           "interface":{
               "fields":[
                   "interfaceid",
                   "hostid",
                   "main",
                   "type",
                   "useip",
                   "ip",
                   "dns",
                   "port",
                   "bulk"
               ],
               "data":[
                   [
                       2,
                       10105,
                       1,
                       1,
                       1,
                       "127.0.0.1",
                       "",
                       "10050",
                       1
                   ]
               ]
           },
           ...
       }

proxy→server:

{
         "response": "success",
         "version": "3.4.0"
       }
Proxy request

The proxy data request is used to obtain host availability, historical, discovery and autoregistration data from proxy. This request is sent every ProxyDataFrequency (server configuration parameter) seconds.

name value type description
server→proxy:
request string 'proxy data'
proxy→server:
host availability array (optional) array of host availability data objects
hostid number host identifier
available number Zabbix agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
error string Zabbix agent error message or empty string
snmp_available number SNMP agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
snmp_error string SNMP agent error message or empty string
ipmi_available number IPMI agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
ipmi_error string IPMI agent error message or empty string
jmx_available number JMX agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
jmx_error string JMX agent error message or empty string
history data array (optional) array of history data objects
itemid number item identifier
clock number item value timestamp (seconds)
ns number item value timestamp (nanoseconds)
value string (optional) item value
timestamp number (optional) timestamp of log type items
source string (optional) eventlog item source value
severity number (optional) eventlog item severity value
eventid number (optional) eventlog item eventid value
state string (optional) item state
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsize number (optional) last logs ize of log type items
mtime number (optional) modify time of log type items
discovery data array (optional) array of discovery data objects
clock number the discovery data timestamp
druleid number the discovery rule identifier
dcheckid number the discovery check indentifier or null for discovery rule data
type number the discovery check type:

-1 discovery rule data
0, SVC_SSH - SSH service check
1, SVC_LDAP - LDAP service check
2, SVC_SMTP - SMTP service check
3, SVC_FTP - FTP service check
4, SVC_HTTP - HTTP service check
5, SVC_POP - POP service check
6, SVC_NNTP - NNTP service check
7, SVC_IMAP - IMAP service check
8, SVC_TCP - TCP port availability check
9, SVC_AGENT - Zabbix agent
10, SVC_SNMPv1 - SNMPv1 agent
11, SVC_SNMPv2 - SNMPv2 agent
12, SVC_ICMPPING - ICMP ping
13, SVC_SNMPv3 - SNMPv3 agent
14, SVC_HTTPS - HTTPS service check
15, SVC_TELNET - Telnet availability check
ip string the host IP address
dns string the host DNS name
port number (optional) service port number
key_ string (optional) the item key for discovery check of type 9 SVC_AGENT
value string (optional) value received from the service, can be empty for most of services
status number (optional) service status:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registration array (optional) array of auto registration data objects
clock number the auto registration data timestamp
host string the host name
ip string (optional) the host IP address
dns string (optional) the resolved DNS name from IP address
port string (optional) the host port
host_metadata string (optional) the host metadata sent by agent (based on HostMetadata or HostMetadataItem agent configuration parameter)
tasks array (optional) array of tasks
type number the task type:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - remote command result
status number the remote command execution status:

0, ZBX_TM_REMOTE_COMMAND_COMPLETED - the remote command completed successfully
1, ZBX_TM_REMOTE_COMMAND_FAILED - the remote command failed
error string (optional) the error message
parent_taskid number the parent task id
more number (optional) 1 - there are more history data to send
clock number data transfer timestamp (seconds)
ns number data transfer timestamp (nanoseconds)
version string the proxy version (<major>.<minor>.<build>)
server→proxy:
response string the request success information ('success' or 'failed')
tasks array (optional) array of tasks
type number the task type:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - remote command
clock number the task creation time
ttl number the time in seconds after which task expires
commandtype number the remote command type:

0, ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT - use custom script
1, ZBX_SCRIPT_TYPE_IPMI - use IPMI
2, ZBX_SCRIPT_TYPE_SSH - use SSH
3, ZBX_SCRIPT_TYPE_TELNET - use Telnet
4, ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT - use global script (currently functionally equivalent to custom script)
command string the remote command to execute
execute_on number the execution target for custom scripts:

0, ZBX_SCRIPT_EXECUTE_ON_AGENT - execute script on agent
1, ZBX_SCRIPT_EXECUTE_ON_SERVER - execute script on server
2, ZBX_SCRIPT_EXECUTE_ON_PROXY - execute script on proxy
port number (optional) the port for telnet and ssh commands
authtype number (optional) the authentication type for ssh commands
username string (optional) the user name for telnet and ssh commands
password string (optional) the password for telnet and ssh commands
publickey string (optional) the public key for ssh commands
privatekey string (optional) the private key for ssh commands
parent_taskid number the parent task id
hostid number target hostid

Example:

server→proxy:

{
         "request": "proxy data"
       }

proxy→server:

{
           "host availability":[
               {
                   "hostid":10106,
                   "available":1,
                   "error":"",
                   "snmp_available":0,
                   "snmp_error":"",
                   "ipmi_available":0,
                   "ipmi_error":"",
                   "jmx_available":0,
                   "jmx_error":""
               },
               {
                   "hostid":10107,
                   "available":1,
                   "error":"",
                   "snmp_available":0,
                   "snmp_error":"",
                   "ipmi_available":0,
                   "ipmi_error":"",
                   "jmx_available":0,
                   "jmx_error":""
               }
           ],
           "history data":[
               {
                   "itemid":"12345",
                   "clock":1478609647,
                   "ns":332510044,
                   "value":"52956612"
               },
               {
                   "itemid":"12346",
                   "clock":1478609647,
                   "ns":330690279,
                   "state":1,
                   "value":"Cannot find information for this network interface in /proc/net/dev."
               }
           ],
           "discovery data":[
               {
                   "clock":1478608764,
                   "drule":2,
                   "dcheck":3,
                   "type":12,
                   "ip":"10.3.0.10",
                   "dns":"vdebian",
                   "status":1
               },
               {
                   "clock":1478608764,
                   "drule":2,
                   "dcheck":null,
                   "type":-1,
                   "ip":"10.3.0.10",
                   "dns":"vdebian",
                   "status":1
               }
           ],
           "auto registration":[
               {
                   "clock":1478608371,
                   "host":"Logger1",
                   "ip":"10.3.0.1",
                   "dns":"localhost",
                   "port":"10050"
               },
               {
                   "clock":1478608381,
                   "host":"Logger2",
                   "ip":"10.3.0.2",
                   "dns":"localhost",
                   "port":"10050"
               }
           ],
           "tasks":[
               {
                   "type": 0,
                   "status": 0,
                   "parent_taskid": 10
               },
               {
                   "type": 0,
                   "status": 1,
                   "error": "No permissions to execute task.",
                   "parent_taskid": 20
               }
           ],    
           "clock":1478609648,
           "ns":157729208,
           "version":"3.4.0"
       }

server→proxy:

{
         "response": "success",
         "tasks":[
             {
                "type": 1,
                "clock": 1478608371,
                "ttl": 600,
                "commandtype": 2,
                "command": "restart_service1.sh",
                "execute_on": 2,
                "port": 80,
                "authtype": 0,
                "username": "userA",
                "password": "password1",
                "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
                "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
                "parent_taskid": 10,
                "hostid": 10070
             },
             {
                "type": 1,
                "clock": 1478608381,
                "ttl": 600,
                "commandtype": 1,
                "command": "restart_service2.sh",
                "execute_on": 0,
                "authtype": 0,
                "username": "",
                "password": "",
                "publickey": "",
                "privatekey": "",
                "parent_taskid": 20,
                "hostid": 10084
             }
         ]
       }

Active proxy

Proxy heartbeat request

The proxy heartbeat request is sent by proxy to report that proxy is running. This request is sent every HeartbeatFrequency (proxy configuration parameter) seconds.

name value type description
proxy→server:
request string 'proxy heartbeat'
host string the proxy name
version string the proxy version (<major>.<minor>.<build>)
server→proxy:
response string the request success information ('success' or 'failed')

proxy→server:

{
          "request": "proxy heartbeat",
          "host": "Proxy #12",
          "version": "3.4.0"
       }

server→proxy:

{
         "response": "success"
       }
Proxy config request

The proxy config request is sent by proxy to obtain proxy configuration data. This request is sent every ConfigFrequency (proxy configuration parameter) seconds.

name value type description
proxy→server:
request string 'proxy config'
host string proxy name
version string the proxy version (<major>.<minor>.<build>)
server→proxy:
request string 'proxy config'
<table> object one or more objects with <table> data
fields array array of field names
- string field name
data array array of rows
- array array of columns
- string,number column value with type depending on column type in database schema
proxy→server:
response string the request success information ('success' or 'failed')

Example:

proxy→server:

{
         "request": "proxy config",
         "host": "Proxy #12",
         "version":"3.4.0"
       }

server→proxy:

{
           "globalmacro":{
               "fields":[
                   "globalmacroid",
                   "macro",
                   "value"
               ],
               "data":[
                   [
                       2,
                       "{$SNMP_COMMUNITY}",
                       "public"
                   ]
               ]
           },
           "hosts":{
               "fields":[
                   "hostid",
                   "host",
                   "status",
                   "ipmi_authtype",
                   "ipmi_privilege",
                   "ipmi_username",
                   "ipmi_password",
                   "name",
                   "tls_connect",
                   "tls_accept",
                   "tls_issuer",
                   "tls_subject",
                   "tls_psk_identity",
                   "tls_psk"
               ],
               "data":[
                   [
                       10001,
                       "Template OS Linux",
                       3,
                       -1,
                       2,
                       "",
                       "",
                       "Template OS Linux",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ],
                   [
                       10050,
                       "Template App Zabbix Agent",
                       3,
                       -1,
                       2,
                       "",
                       "",
                       "Template App Zabbix Agent",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ],
                   [
                       10105,
                       "Logger",
                       0,
                       -1,
                       2,
                       "",
                       "",
                       "Logger",
                       1,
                       1,
                       "",
                       "",
                       "",
                       ""
                   ]
               ]
           },
           "interface":{
               "fields":[
                   "interfaceid",
                   "hostid",
                   "main",
                   "type",
                   "useip",
                   "ip",
                   "dns",
                   "port",
                   "bulk"
               ],
               "data":[
                   [
                       2,
                       10105,
                       1,
                       1,
                       1,
                       "127.0.0.1",
                       "",
                       "10050",
                       1
                   ]
               ]
           },
           ...
       }

proxy→server:

{
         "response": "success"
       }
Proxy data request

The proxy data request is sent by proxy to provide host availability, history, discovery and auto registation data. This request is sent every DataSenderFrequency (proxy configuration parameter) seconds.

name value type description
proxy→server:
request string 'proxy data'
host string the proxy name
host availability array (optional) array of host availability data objects
hostid number host identifier
available number Zabbix agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
error string Zabbix agent error message or empty string
snmp_available number SNMP agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
snmp_error string SNMP agent error message or empty string
ipmi_available number IPMI agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
ipmi_error string IPMI agent error message or empty string
jmx_available number JMX agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
jmx_error string JMX agent error message or empty string
history data array (optional) array of history data objects
itemid number item identifier
clock number item value timestamp (seconds)
ns number item value timestamp (nanoseconds)
value string (optional) item value
timestamp number (optional) timestamp of log type items
source string (optional) eventlog item source value
severity number (optional) eventlog item severity value
eventid number (optional) eventlog item eventid value
state string (optional) item state
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsize number (optional) last logs ize of log type items
mtime number (optional) modify time of log type items
discovery data array (optional) array of discovery data objects
clock number the discovery data timestamp
druleid number the discovery rule identifier
dcheckid number the discovery check indentifier or null for discovery rule data
type number the discovery check type:

-1 discovery rule data
0, SVC_SSH - SSH service check
1, SVC_LDAP - LDAP service check
2, SVC_SMTP - SMTP service check
3, SVC_FTP - FTP service check
4, SVC_HTTP - HTTP service check
5, SVC_POP - POP service check
6, SVC_NNTP - NNTP service check
7, SVC_IMAP - IMAP service check
8, SVC_TCP - TCP port availability check
9, SVC_AGENT - Zabbix agent
10, SVC_SNMPv1 - SNMPv1 agent
11, SVC_SNMPv2 - SNMPv2 agent
12, SVC_ICMPPING - ICMP ping
13, SVC_SNMPv3 - SNMPv3 agent
14, SVC_HTTPS - HTTPS service check
15, SVC_TELNET - Telnet availability check
ip string the host IP address
dns string the host DNS name
port number (optional) service port number
key_ string (optional) the item key for discovery check of type 9 SVC_AGENT
value string (optional) value received from the service, can be empty for most of services
status number (optional) service status:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registration array (optional) array of auto registration data objects
clock number the auto registration data timestamp
host string the host name
ip string (optional) the host IP address
dns string (optional) the resolved DNS name from IP address
port string (optional) the host port
host_metadata string (optional) the host metadata sent by agent (based on HostMetadata or HostMetadataItem agent configuration parameter)
tasks array (optional) array of tasks
type number the task type:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - remote command result
status number the remote command execution status:

0, ZBX_TM_REMOTE_COMMAND_COMPLETED - the remote command completed successfully
1, ZBX_TM_REMOTE_COMMAND_FAILED - the remote command failed
error string (optional) the error message
parent_taskid number the parent task id
more number (optional) 1 - there are more history data to send
clock number data transfer timestamp (seconds)
ns number data transfer timestamp (nanoseconds)
version string the proxy version (<major>.<minor>.<build>)
server→proxy:
response string the request success information ('success' or 'failed')
tasks array (optional) array of tasks
type number the task type:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - remote command
clock number the task creation time
ttl number the time in seconds after which task expires
commandtype number the remote command type:

0, ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT - use custom script
1, ZBX_SCRIPT_TYPE_IPMI - use IPMI
2, ZBX_SCRIPT_TYPE_SSH - use SSH
3, ZBX_SCRIPT_TYPE_TELNET - use Telnet
4, ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT - use global script (currently functionally equivalent to custom script)
command string the remote command to execute
execute_on number the execution target for custom scripts:

0, ZBX_SCRIPT_EXECUTE_ON_AGENT - execute script on agent
1, ZBX_SCRIPT_EXECUTE_ON_SERVER - execute script on server
2, ZBX_SCRIPT_EXECUTE_ON_PROXY - execute script on proxy
port number (optional) the port for telnet and ssh commands
authtype number (optional) the authentication type for ssh commands
username string (optional) the user name for telnet and ssh commands
password string (optional) the password for telnet and ssh commands
publickey string (optional) the public key for ssh commands
privatekey string (optional) the private key for ssh commands
parent_taskid number the parent task id
hostid number target hostid

Example:

proxy→server:

{
         "request": "proxy data",
         "host": "Proxy #12", 
           "host availability":[
               {
                   "hostid":10106,
                   "available":1,
                   "error":"",
                   "snmp_available":0,
                   "snmp_error":"",
                   "ipmi_available":0,
                   "ipmi_error":"",
                   "jmx_available":0,
                   "jmx_error":""
               },
               {
                   "hostid":10107,
                   "available":1,
                   "error":"",
                   "snmp_available":0,
                   "snmp_error":"",
                   "ipmi_available":0,
                   "ipmi_error":"",
                   "jmx_available":0,
                   "jmx_error":""
               }
           ],
           "history data":[
               {
                   "itemid":"12345",
                   "clock":1478609647,
                   "ns":332510044,
                   "value":"52956612"
               },
               {
                   "itemid":"12346",
                   "clock":1478609647,
                   "ns":330690279,
                   "state":1,
                   "value":"Cannot find information for this network interface in /proc/net/dev."
               }
           ],
           "discovery data":[
               {
                   "clock":1478608764,
                   "drule":2,
                   "dcheck":3,
                   "type":12,
                   "ip":"10.3.0.10",
                   "dns":"vdebian",
                   "status":1
               },
               {
                   "clock":1478608764,
                   "drule":2,
                   "dcheck":null,
                   "type":-1,
                   "ip":"10.3.0.10",
                   "dns":"vdebian",
                   "status":1
               }
           ],
           "auto registration":[
               {
                   "clock":1478608371,
                   "host":"Logger1",
                   "ip":"10.3.0.1",
                   "dns":"localhost",
                   "port":"10050"
               },
               {
                   "clock":1478608381,
                   "host":"Logger2",
                   "ip":"10.3.0.2",
                   "dns":"localhost",
                   "port":"10050"
               }
           ],
           "tasks":[
               {
                   "type": 2,
                   "clock":1478608371,
                   "ttl": 600,
                   "commandtype": 2,
                   "command": "restart_service1.sh",
                   "execute_on": 2,
                   "port": 80,
                   "authtype": 0,
                   "username": "userA",
                   "password": "password1",
                   "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
                   "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
                   "parent_taskid": 10,
                   "hostid": 10070
               },
               {
                   "type": 2,
                   "clock":1478608381,
                   "ttl": 600,
                   "commandtype": 1,
                   "command": "restart_service2.sh",
                   "execute_on": 0,
                   "authtype": 0,
                   "username": "",
                   "password": "",
                   "publickey": "",
                   "privatekey": "",
                   "parent_taskid": 20,
                   "hostid": 10084
               }
           ],
           "tasks":[
               {
                   "type": 0,
                   "status": 0,
                   "parent_taskid": 10
               },
               {
                   "type": 0,
                   "status": 1,
                   "error": "No permissions to execute task.",
                   "parent_taskid": 20
               }
           ], 
           "clock":1478609648,
           "ns":157729208,
           "version":"3.4.0"
       }

server→proxy:

{
         "response": "success",
         "tasks":[
             {
                "type": 1,
                "clock": 1478608371,
                "ttl": 600,
                "commandtype": 2,
                "command": "restart_service1.sh",
                "execute_on": 2,
                "port": 80,
                "authtype": 0,
                "username": "userA",
                "password": "password1",
                "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
                "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
                "parent_taskid": 10,
                "hostid": 10070
             },
             {
                "type": 1,
                "clock": 1478608381,
                "ttl": 600,
                "commandtype": 1,
                "command": "restart_service2.sh",
                "execute_on": 0,
                "authtype": 0,
                "username": "",
                "password": "",
                "publickey": "",
                "privatekey": "",
                "parent_taskid": 20,
                "hostid": 10084
             }
         ]
       }

Backwards compatibility

Server supports partial backwards compatibility by accepting old host availability, history data, discovery data and auto registration requests.