1 Server-proxy 数据交换协议

概述

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

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

被动代理

代理配置请求

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

namevalue typedescription
server→proxy:
requeststring‘proxy config’
<table>objectone or more objects with <table> data
fieldsarrayarray of field names
-stringfield name
dataarrayarray of rows
-arrayarray of columns
-string,numbercolumn value with type depending on column type in database schema
proxy→server:
responsestringthe request success information (‘success’ or ‘failed’)
versionstringthe proxy version (<major>.<minor>.<build>)

例:

server→proxy:

  1. {
  2. "request": "proxy config",
  3. "globalmacro":{
  4. "fields":[
  5. "globalmacroid",
  6. "macro",
  7. "value"
  8. ],
  9. "data":[
  10. [
  11. 2,
  12. "{$SNMP_COMMUNITY}",
  13. "public"
  14. ]
  15. ]
  16. },
  17. "hosts":{
  18. "fields":[
  19. "hostid",
  20. "host",
  21. "status",
  22. "ipmi_authtype",
  23. "ipmi_privilege",
  24. "ipmi_username",
  25. "ipmi_password",
  26. "name",
  27. "tls_connect",
  28. "tls_accept",
  29. "tls_issuer",
  30. "tls_subject",
  31. "tls_psk_identity",
  32. "tls_psk"
  33. ],
  34. "data":[
  35. [
  36. 10001,
  37. "Template OS Linux",
  38. 3,
  39. -1,
  40. 2,
  41. "",
  42. "",
  43. "Template OS Linux",
  44. 1,
  45. 1,
  46. "",
  47. "",
  48. "",
  49. ""
  50. ],
  51. [
  52. 10050,
  53. "Template App Zabbix Agent",
  54. 3,
  55. -1,
  56. 2,
  57. "",
  58. "",
  59. "Template App Zabbix Agent",
  60. 1,
  61. 1,
  62. "",
  63. "",
  64. "",
  65. ""
  66. ],
  67. [
  68. 10105,
  69. "Logger",
  70. 0,
  71. -1,
  72. 2,
  73. "",
  74. "",
  75. "Logger",
  76. 1,
  77. 1,
  78. "",
  79. "",
  80. "",
  81. ""
  82. ]
  83. ]
  84. },
  85. "interface":{
  86. "fields":[
  87. "interfaceid",
  88. "hostid",
  89. "main",
  90. "type",
  91. "useip",
  92. "ip",
  93. "dns",
  94. "port",
  95. "bulk"
  96. ],
  97. "data":[
  98. [
  99. 2,
  100. 10105,
  101. 1,
  102. 1,
  103. 1,
  104. "127.0.0.1",
  105. "",
  106. "10050",
  107. 1
  108. ]
  109. ]
  110. },
  111. ...
  112. }

proxy→server:

  1. {
  2. "response": "success",
  3. "version": "3.4.0"
  4. }
代理请求

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

namevalue typedescription
server→proxy:
requeststring‘proxy data’
proxy→server:
host availabilityarray(optional) array of host availability data objects
hostidnumberhost identifier
availablenumberZabbix agent availability

0, HOSTAVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
errorstringZabbix agent error message or empty string
snmp_availablenumberSNMP agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
snmp_errorstringSNMP agent error message or empty string
ipmi_availablenumberIPMI agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
ipmi_errorstringIPMI agent error message or empty string
jmx_availablenumberJMX agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
jmx_errorstringJMX agent error message or empty string
history dataarray(optional) array of history data objects
itemidnumberitem identifier
clocknumberitem value timestamp (seconds)
nsnumberitem value timestamp (nanoseconds)
valuestring(optional) item value
timestampnumber(optional) timestamp of log type items
sourcestring(optional) eventlog item source value
severitynumber(optional) eventlog item severity value
eventidnumber(optional) eventlog item eventid value
statestring(optional) item state
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsizenumber(optional) last logs ize of log type items
mtimenumber(optional) modify time of log type items
discovery dataarray(optional) array of discovery data objects
clocknumberthe discovery data timestamp
druleidnumberthe discovery rule identifier
dcheckidnumberthe discovery check indentifier or null for discovery rule data
typenumberthe 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
ipstringthe host IP address
dnsstringthe host DNS name
portnumber(optional) service port number
keystring(optional) the item key for discovery check of type 9 SVC_AGENT
valuestring(optional) value received from the service, can be empty for most of services
statusnumber(optional) service status:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registrationarray(optional) array of auto registration data objects
clocknumberthe auto registration data timestamp
hoststringthe host name
ipstring(optional) the host IP address
dnsstring(optional) the resolved DNS name from IP address
portstring(optional) the host port
host_metadatastring(optional) the host metadata sent by agent (based on HostMetadata or HostMetadataItem agent configuration parameter)
tasksarray(optional) array of tasks
typenumberthe task type:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - remote command result
statusnumberthe 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
errorstring(optional) the error message
parent_taskidnumberthe parent task id
morenumber(optional) 1 - there are more history data to send
clocknumberdata transfer timestamp (seconds)
nsnumberdata transfer timestamp (nanoseconds)
versionstringthe proxy version (<major>.<minor>.<build>)
server→proxy:
responsestringthe request success information (‘success’ or ‘failed’)
tasksarray(optional) array of tasks
typenumberthe task type:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - remote command
clocknumberthe task creation time
ttlnumberthe time in seconds after which task expires
commandtypenumberthe 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)
commandstringthe remote command to execute
execute_onnumberthe 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
portnumber(optional) the port for telnet and ssh commands
authtypenumber(optional) the authentication type for ssh commands
usernamestring(optional) the user name for telnet and ssh commands
passwordstring(optional) the password for telnet and ssh commands
publickeystring(optional) the public key for ssh commands
privatekeystring(optional) the private key for ssh commands
parent_taskidnumberthe parent task id
hostidnumbertarget hostid

例如:

server→proxy:

  1. {
  2. "request": "proxy data"
  3. }

proxy→server:

  1. {
  2. "host availability":[
  3. {
  4. "hostid":10106,
  5. "available":1,
  6. "error":"",
  7. "snmp_available":0,
  8. "snmp_error":"",
  9. "ipmi_available":0,
  10. "ipmi_error":"",
  11. "jmx_available":0,
  12. "jmx_error":""
  13. },
  14. {
  15. "hostid":10107,
  16. "available":1,
  17. "error":"",
  18. "snmp_available":0,
  19. "snmp_error":"",
  20. "ipmi_available":0,
  21. "ipmi_error":"",
  22. "jmx_available":0,
  23. "jmx_error":""
  24. }
  25. ],
  26. "history data":[
  27. {
  28. "itemid":"12345",
  29. "clock":1478609647,
  30. "ns":332510044,
  31. "value":"52956612"
  32. },
  33. {
  34. "itemid":"12346",
  35. "clock":1478609647,
  36. "ns":330690279,
  37. "state":1,
  38. "value":"Cannot find information for this network interface in /proc/net/dev."
  39. }
  40. ],
  41. "discovery data":[
  42. {
  43. "clock":1478608764,
  44. "drule":2,
  45. "dcheck":3,
  46. "type":12,
  47. "ip":"10.3.0.10",
  48. "dns":"vdebian",
  49. "status":1
  50. },
  51. {
  52. "clock":1478608764,
  53. "drule":2,
  54. "dcheck":null,
  55. "type":-1,
  56. "ip":"10.3.0.10",
  57. "dns":"vdebian",
  58. "status":1
  59. }
  60. ],
  61. "auto registration":[
  62. {
  63. "clock":1478608371,
  64. "host":"Logger1",
  65. "ip":"10.3.0.1",
  66. "dns":"localhost",
  67. "port":"10050"
  68. },
  69. {
  70. "clock":1478608381,
  71. "host":"Logger2",
  72. "ip":"10.3.0.2",
  73. "dns":"localhost",
  74. "port":"10050"
  75. }
  76. ],
  77. "tasks":[
  78. {
  79. "type": 0,
  80. "status": 0,
  81. "parent_taskid": 10
  82. },
  83. {
  84. "type": 0,
  85. "status": 1,
  86. "error": "No permissions to execute task.",
  87. "parent_taskid": 20
  88. }
  89. ],
  90. "clock":1478609648,
  91. "ns":157729208,
  92. "version":"3.4.0"
  93. }

server→proxy:

  1. {
  2. "response": "success",
  3. "tasks":[
  4. {
  5. "type": 1,
  6. "clock": 1478608371,
  7. "ttl": 600,
  8. "commandtype": 2,
  9. "command": "restart_service1.sh",
  10. "execute_on": 2,
  11. "port": 80,
  12. "authtype": 0,
  13. "username": "userA",
  14. "password": "password1",
  15. "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
  16. "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
  17. "parent_taskid": 10,
  18. "hostid": 10070
  19. },
  20. {
  21. "type": 1,
  22. "clock": 1478608381,
  23. "ttl": 600,
  24. "commandtype": 1,
  25. "command": "restart_service2.sh",
  26. "execute_on": 0,
  27. "authtype": 0,
  28. "username": "",
  29. "password": "",
  30. "publickey": "",
  31. "privatekey": "",
  32. "parent_taskid": 20,
  33. "hostid": 10084
  34. }
  35. ]
  36. }

主动代理

代理心跳请求

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

namevalue typedescription
proxy→server:
requeststring‘proxy heartbeat’
hoststringthe proxy name
versionstringthe proxy version (<major>.<minor>.<build>)
server→proxy:
responsestringthe request success information (‘success’ or ‘failed’)

proxy→server:

  1. {
  2. "request": "proxy heartbeat",
  3. "host": "Proxy #12",
  4. "version": "3.4.0"
  5. }

server→proxy:

  1. {
  2. "response": "success"
  3. }
代理配置请求

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

namevalue typedescription
proxy→server:
requeststring‘proxy config’
hoststringproxy name
versionstringthe proxy version (<major>.<minor>.<build>)
server→proxy:
requeststring‘proxy config’
<table>objectone or more objects with <table> data
fieldsarrayarray of field names
-stringfield name
dataarrayarray of rows
-arrayarray of columns
-string,numbercolumn value with type depending on column type in database schema
proxy→server:
responsestringthe request success information (‘success’ or ‘failed’)

Example:

proxy→server:

  1. {
  2. "request": "proxy config",
  3. "host": "Proxy #12",
  4. "version":"3.4.0"
  5. }

server→proxy:

  1. {
  2. "globalmacro":{
  3. "fields":[
  4. "globalmacroid",
  5. "macro",
  6. "value"
  7. ],
  8. "data":[
  9. [
  10. 2,
  11. "{$SNMP_COMMUNITY}",
  12. "public"
  13. ]
  14. ]
  15. },
  16. "hosts":{
  17. "fields":[
  18. "hostid",
  19. "host",
  20. "status",
  21. "ipmi_authtype",
  22. "ipmi_privilege",
  23. "ipmi_username",
  24. "ipmi_password",
  25. "name",
  26. "tls_connect",
  27. "tls_accept",
  28. "tls_issuer",
  29. "tls_subject",
  30. "tls_psk_identity",
  31. "tls_psk"
  32. ],
  33. "data":[
  34. [
  35. 10001,
  36. "Template OS Linux",
  37. 3,
  38. -1,
  39. 2,
  40. "",
  41. "",
  42. "Template OS Linux",
  43. 1,
  44. 1,
  45. "",
  46. "",
  47. "",
  48. ""
  49. ],
  50. [
  51. 10050,
  52. "Template App Zabbix Agent",
  53. 3,
  54. -1,
  55. 2,
  56. "",
  57. "",
  58. "Template App Zabbix Agent",
  59. 1,
  60. 1,
  61. "",
  62. "",
  63. "",
  64. ""
  65. ],
  66. [
  67. 10105,
  68. "Logger",
  69. 0,
  70. -1,
  71. 2,
  72. "",
  73. "",
  74. "Logger",
  75. 1,
  76. 1,
  77. "",
  78. "",
  79. "",
  80. ""
  81. ]
  82. ]
  83. },
  84. "interface":{
  85. "fields":[
  86. "interfaceid",
  87. "hostid",
  88. "main",
  89. "type",
  90. "useip",
  91. "ip",
  92. "dns",
  93. "port",
  94. "bulk"
  95. ],
  96. "data":[
  97. [
  98. 2,
  99. 10105,
  100. 1,
  101. 1,
  102. 1,
  103. "127.0.0.1",
  104. "",
  105. "10050",
  106. 1
  107. ]
  108. ]
  109. },
  110. ...
  111. }

proxy→server:

  1. {
  2. "response": "success"
  3. }
代理数据请求

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

namevalue typedescription
proxy→server:
requeststring‘proxy data’
hoststringthe proxy name
host availabilityarray(optional) array of host availability data objects
hostidnumberhost identifier
availablenumberZabbix agent availability

0, HOSTAVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
errorstringZabbix agent error message or empty string
snmp_availablenumberSNMP agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
snmp_errorstringSNMP agent error message or empty string
ipmi_availablenumberIPMI agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
ipmi_errorstringIPMI agent error message or empty string
jmx_availablenumberJMX agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
jmx_errorstringJMX agent error message or empty string
history dataarray(optional) array of history data objects
itemidnumberitem identifier
clocknumberitem value timestamp (seconds)
nsnumberitem value timestamp (nanoseconds)
valuestring(optional) item value
timestampnumber(optional) timestamp of log type items
sourcestring(optional) eventlog item source value
severitynumber(optional) eventlog item severity value
eventidnumber(optional) eventlog item eventid value
statestring(optional) item state
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsizenumber(optional) last logs ize of log type items
mtimenumber(optional) modify time of log type items
discovery dataarray(optional) array of discovery data objects
clocknumberthe discovery data timestamp
druleidnumberthe discovery rule identifier
dcheckidnumberthe discovery check indentifier or null for discovery rule data
typenumberthe 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
ipstringthe host IP address
dnsstringthe host DNS name
portnumber(optional) service port number
keystring(optional) the item key for discovery check of type 9 SVC_AGENT
valuestring(optional) value received from the service, can be empty for most of services
statusnumber(optional) service status:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registrationarray(optional) array of auto registration data objects
clocknumberthe auto registration data timestamp
hoststringthe host name
ipstring(optional) the host IP address
dnsstring(optional) the resolved DNS name from IP address
portstring(optional) the host port
host_metadatastring(optional) the host metadata sent by agent (based on HostMetadata or HostMetadataItem agent configuration parameter)
tasksarray(optional) array of tasks
typenumberthe task type:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - remote command result
statusnumberthe 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
errorstring(optional) the error message
parent_taskidnumberthe parent task id
morenumber(optional) 1 - there are more history data to send
clocknumberdata transfer timestamp (seconds)
nsnumberdata transfer timestamp (nanoseconds)
versionstringthe proxy version (<major>.<minor>.<build>)
server→proxy:
responsestringthe request success information (‘success’ or ‘failed’)
tasksarray(optional) array of tasks
typenumberthe task type:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - remote command
clocknumberthe task creation time
ttlnumberthe time in seconds after which task expires
commandtypenumberthe 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)
commandstringthe remote command to execute
execute_onnumberthe 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
portnumber(optional) the port for telnet and ssh commands
authtypenumber(optional) the authentication type for ssh commands
usernamestring(optional) the user name for telnet and ssh commands
passwordstring(optional) the password for telnet and ssh commands
publickeystring(optional) the public key for ssh commands
privatekeystring(optional) the private key for ssh commands
parent_taskidnumberthe parent task id
hostidnumbertarget hostid

例如:

proxy→server:

  1. {
  2. "request": "proxy data",
  3. "host": "Proxy #12",
  4. "host availability":[
  5. {
  6. "hostid":10106,
  7. "available":1,
  8. "error":"",
  9. "snmp_available":0,
  10. "snmp_error":"",
  11. "ipmi_available":0,
  12. "ipmi_error":"",
  13. "jmx_available":0,
  14. "jmx_error":""
  15. },
  16. {
  17. "hostid":10107,
  18. "available":1,
  19. "error":"",
  20. "snmp_available":0,
  21. "snmp_error":"",
  22. "ipmi_available":0,
  23. "ipmi_error":"",
  24. "jmx_available":0,
  25. "jmx_error":""
  26. }
  27. ],
  28. "history data":[
  29. {
  30. "itemid":"12345",
  31. "clock":1478609647,
  32. "ns":332510044,
  33. "value":"52956612"
  34. },
  35. {
  36. "itemid":"12346",
  37. "clock":1478609647,
  38. "ns":330690279,
  39. "state":1,
  40. "value":"Cannot find information for this network interface in /proc/net/dev."
  41. }
  42. ],
  43. "discovery data":[
  44. {
  45. "clock":1478608764,
  46. "drule":2,
  47. "dcheck":3,
  48. "type":12,
  49. "ip":"10.3.0.10",
  50. "dns":"vdebian",
  51. "status":1
  52. },
  53. {
  54. "clock":1478608764,
  55. "drule":2,
  56. "dcheck":null,
  57. "type":-1,
  58. "ip":"10.3.0.10",
  59. "dns":"vdebian",
  60. "status":1
  61. }
  62. ],
  63. "auto registration":[
  64. {
  65. "clock":1478608371,
  66. "host":"Logger1",
  67. "ip":"10.3.0.1",
  68. "dns":"localhost",
  69. "port":"10050"
  70. },
  71. {
  72. "clock":1478608381,
  73. "host":"Logger2",
  74. "ip":"10.3.0.2",
  75. "dns":"localhost",
  76. "port":"10050"
  77. }
  78. ],
  79. "tasks":[
  80. {
  81. "type": 2,
  82. "clock":1478608371,
  83. "ttl": 600,
  84. "commandtype": 2,
  85. "command": "restart_service1.sh",
  86. "execute_on": 2,
  87. "port": 80,
  88. "authtype": 0,
  89. "username": "userA",
  90. "password": "password1",
  91. "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
  92. "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
  93. "parent_taskid": 10,
  94. "hostid": 10070
  95. },
  96. {
  97. "type": 2,
  98. "clock":1478608381,
  99. "ttl": 600,
  100. "commandtype": 1,
  101. "command": "restart_service2.sh",
  102. "execute_on": 0,
  103. "authtype": 0,
  104. "username": "",
  105. "password": "",
  106. "publickey": "",
  107. "privatekey": "",
  108. "parent_taskid": 20,
  109. "hostid": 10084
  110. }
  111. ],
  112. "tasks":[
  113. {
  114. "type": 0,
  115. "status": 0,
  116. "parent_taskid": 10
  117. },
  118. {
  119. "type": 0,
  120. "status": 1,
  121. "error": "No permissions to execute task.",
  122. "parent_taskid": 20
  123. }
  124. ],
  125. "clock":1478609648,
  126. "ns":157729208,
  127. "version":"3.4.0"
  128. }

server→proxy:

  1. {
  2. "response": "success",
  3. "tasks":[
  4. {
  5. "type": 1,
  6. "clock": 1478608371,
  7. "ttl": 600,
  8. "commandtype": 2,
  9. "command": "restart_service1.sh",
  10. "execute_on": 2,
  11. "port": 80,
  12. "authtype": 0,
  13. "username": "userA",
  14. "password": "password1",
  15. "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
  16. "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
  17. "parent_taskid": 10,
  18. "hostid": 10070
  19. },
  20. {
  21. "type": 1,
  22. "clock": 1478608381,
  23. "ttl": 600,
  24. "commandtype": 1,
  25. "command": "restart_service2.sh",
  26. "execute_on": 0,
  27. "authtype": 0,
  28. "username": "",
  29. "password": "",
  30. "publickey": "",
  31. "privatekey": "",
  32. "parent_taskid": 20,
  33. "hostid": 10084
  34. }
  35. ]
  36. }

向后兼容性

服务器通过接受旧的支持部分向后兼容 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.

namevalue typedescription
server→proxy:
requeststring‘proxy config’
<table>objectone or more objects with <table> data
fieldsarrayarray of field names
-stringfield name
dataarrayarray of rows
-arrayarray of columns
-string,numbercolumn value with type depending on column type in database schema
proxy→server:
responsestringthe request success information (‘success’ or ‘failed’)
versionstringthe proxy version (<major>.<minor>.<build>)

Example:

server→proxy:

  1. {
  2. "request": "proxy config",
  3. "globalmacro":{
  4. "fields":[
  5. "globalmacroid",
  6. "macro",
  7. "value"
  8. ],
  9. "data":[
  10. [
  11. 2,
  12. "{$SNMP_COMMUNITY}",
  13. "public"
  14. ]
  15. ]
  16. },
  17. "hosts":{
  18. "fields":[
  19. "hostid",
  20. "host",
  21. "status",
  22. "ipmi_authtype",
  23. "ipmi_privilege",
  24. "ipmi_username",
  25. "ipmi_password",
  26. "name",
  27. "tls_connect",
  28. "tls_accept",
  29. "tls_issuer",
  30. "tls_subject",
  31. "tls_psk_identity",
  32. "tls_psk"
  33. ],
  34. "data":[
  35. [
  36. 10001,
  37. "Template OS Linux",
  38. 3,
  39. -1,
  40. 2,
  41. "",
  42. "",
  43. "Template OS Linux",
  44. 1,
  45. 1,
  46. "",
  47. "",
  48. "",
  49. ""
  50. ],
  51. [
  52. 10050,
  53. "Template App Zabbix Agent",
  54. 3,
  55. -1,
  56. 2,
  57. "",
  58. "",
  59. "Template App Zabbix Agent",
  60. 1,
  61. 1,
  62. "",
  63. "",
  64. "",
  65. ""
  66. ],
  67. [
  68. 10105,
  69. "Logger",
  70. 0,
  71. -1,
  72. 2,
  73. "",
  74. "",
  75. "Logger",
  76. 1,
  77. 1,
  78. "",
  79. "",
  80. "",
  81. ""
  82. ]
  83. ]
  84. },
  85. "interface":{
  86. "fields":[
  87. "interfaceid",
  88. "hostid",
  89. "main",
  90. "type",
  91. "useip",
  92. "ip",
  93. "dns",
  94. "port",
  95. "bulk"
  96. ],
  97. "data":[
  98. [
  99. 2,
  100. 10105,
  101. 1,
  102. 1,
  103. 1,
  104. "127.0.0.1",
  105. "",
  106. "10050",
  107. 1
  108. ]
  109. ]
  110. },
  111. ...
  112. }

proxy→server:

  1. {
  2. "response": "success",
  3. "version": "3.4.0"
  4. }
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.

namevalue typedescription
server→proxy:
requeststring‘proxy data’
proxy→server:
host availabilityarray(optional) array of host availability data objects
hostidnumberhost identifier
availablenumberZabbix agent availability

0, HOSTAVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
errorstringZabbix agent error message or empty string
snmp_availablenumberSNMP agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
snmp_errorstringSNMP agent error message or empty string
ipmi_availablenumberIPMI agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
ipmi_errorstringIPMI agent error message or empty string
jmx_availablenumberJMX agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
jmx_errorstringJMX agent error message or empty string
history dataarray(optional) array of history data objects
itemidnumberitem identifier
clocknumberitem value timestamp (seconds)
nsnumberitem value timestamp (nanoseconds)
valuestring(optional) item value
timestampnumber(optional) timestamp of log type items
sourcestring(optional) eventlog item source value
severitynumber(optional) eventlog item severity value
eventidnumber(optional) eventlog item eventid value
statestring(optional) item state
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsizenumber(optional) last logs ize of log type items
mtimenumber(optional) modify time of log type items
discovery dataarray(optional) array of discovery data objects
clocknumberthe discovery data timestamp
druleidnumberthe discovery rule identifier
dcheckidnumberthe discovery check indentifier or null for discovery rule data
typenumberthe 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
ipstringthe host IP address
dnsstringthe host DNS name
portnumber(optional) service port number
keystring(optional) the item key for discovery check of type 9 SVC_AGENT
valuestring(optional) value received from the service, can be empty for most of services
statusnumber(optional) service status:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registrationarray(optional) array of auto registration data objects
clocknumberthe auto registration data timestamp
hoststringthe host name
ipstring(optional) the host IP address
dnsstring(optional) the resolved DNS name from IP address
portstring(optional) the host port
host_metadatastring(optional) the host metadata sent by agent (based on HostMetadata or HostMetadataItem agent configuration parameter)
tasksarray(optional) array of tasks
typenumberthe task type:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - remote command result
statusnumberthe 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
errorstring(optional) the error message
parent_taskidnumberthe parent task id
morenumber(optional) 1 - there are more history data to send
clocknumberdata transfer timestamp (seconds)
nsnumberdata transfer timestamp (nanoseconds)
versionstringthe proxy version (<major>.<minor>.<build>)
server→proxy:
responsestringthe request success information (‘success’ or ‘failed’)
tasksarray(optional) array of tasks
typenumberthe task type:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - remote command
clocknumberthe task creation time
ttlnumberthe time in seconds after which task expires
commandtypenumberthe 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)
commandstringthe remote command to execute
execute_onnumberthe 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
portnumber(optional) the port for telnet and ssh commands
authtypenumber(optional) the authentication type for ssh commands
usernamestring(optional) the user name for telnet and ssh commands
passwordstring(optional) the password for telnet and ssh commands
publickeystring(optional) the public key for ssh commands
privatekeystring(optional) the private key for ssh commands
parent_taskidnumberthe parent task id
hostidnumbertarget hostid

Example:

server→proxy:

  1. {
  2. "request": "proxy data"
  3. }

proxy→server:

  1. {
  2. "host availability":[
  3. {
  4. "hostid":10106,
  5. "available":1,
  6. "error":"",
  7. "snmp_available":0,
  8. "snmp_error":"",
  9. "ipmi_available":0,
  10. "ipmi_error":"",
  11. "jmx_available":0,
  12. "jmx_error":""
  13. },
  14. {
  15. "hostid":10107,
  16. "available":1,
  17. "error":"",
  18. "snmp_available":0,
  19. "snmp_error":"",
  20. "ipmi_available":0,
  21. "ipmi_error":"",
  22. "jmx_available":0,
  23. "jmx_error":""
  24. }
  25. ],
  26. "history data":[
  27. {
  28. "itemid":"12345",
  29. "clock":1478609647,
  30. "ns":332510044,
  31. "value":"52956612"
  32. },
  33. {
  34. "itemid":"12346",
  35. "clock":1478609647,
  36. "ns":330690279,
  37. "state":1,
  38. "value":"Cannot find information for this network interface in /proc/net/dev."
  39. }
  40. ],
  41. "discovery data":[
  42. {
  43. "clock":1478608764,
  44. "drule":2,
  45. "dcheck":3,
  46. "type":12,
  47. "ip":"10.3.0.10",
  48. "dns":"vdebian",
  49. "status":1
  50. },
  51. {
  52. "clock":1478608764,
  53. "drule":2,
  54. "dcheck":null,
  55. "type":-1,
  56. "ip":"10.3.0.10",
  57. "dns":"vdebian",
  58. "status":1
  59. }
  60. ],
  61. "auto registration":[
  62. {
  63. "clock":1478608371,
  64. "host":"Logger1",
  65. "ip":"10.3.0.1",
  66. "dns":"localhost",
  67. "port":"10050"
  68. },
  69. {
  70. "clock":1478608381,
  71. "host":"Logger2",
  72. "ip":"10.3.0.2",
  73. "dns":"localhost",
  74. "port":"10050"
  75. }
  76. ],
  77. "tasks":[
  78. {
  79. "type": 0,
  80. "status": 0,
  81. "parent_taskid": 10
  82. },
  83. {
  84. "type": 0,
  85. "status": 1,
  86. "error": "No permissions to execute task.",
  87. "parent_taskid": 20
  88. }
  89. ],
  90. "clock":1478609648,
  91. "ns":157729208,
  92. "version":"3.4.0"
  93. }

server→proxy:

  1. {
  2. "response": "success",
  3. "tasks":[
  4. {
  5. "type": 1,
  6. "clock": 1478608371,
  7. "ttl": 600,
  8. "commandtype": 2,
  9. "command": "restart_service1.sh",
  10. "execute_on": 2,
  11. "port": 80,
  12. "authtype": 0,
  13. "username": "userA",
  14. "password": "password1",
  15. "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
  16. "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
  17. "parent_taskid": 10,
  18. "hostid": 10070
  19. },
  20. {
  21. "type": 1,
  22. "clock": 1478608381,
  23. "ttl": 600,
  24. "commandtype": 1,
  25. "command": "restart_service2.sh",
  26. "execute_on": 0,
  27. "authtype": 0,
  28. "username": "",
  29. "password": "",
  30. "publickey": "",
  31. "privatekey": "",
  32. "parent_taskid": 20,
  33. "hostid": 10084
  34. }
  35. ]
  36. }

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.

namevalue typedescription
proxy→server:
requeststring‘proxy heartbeat’
hoststringthe proxy name
versionstringthe proxy version (<major>.<minor>.<build>)
server→proxy:
responsestringthe request success information (‘success’ or ‘failed’)

proxy→server:

  1. {
  2. "request": "proxy heartbeat",
  3. "host": "Proxy #12",
  4. "version": "3.4.0"
  5. }

server→proxy:

  1. {
  2. "response": "success"
  3. }
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.

namevalue typedescription
proxy→server:
requeststring‘proxy config’
hoststringproxy name
versionstringthe proxy version (<major>.<minor>.<build>)
server→proxy:
requeststring‘proxy config’
<table>objectone or more objects with <table> data
fieldsarrayarray of field names
-stringfield name
dataarrayarray of rows
-arrayarray of columns
-string,numbercolumn value with type depending on column type in database schema
proxy→server:
responsestringthe request success information (‘success’ or ‘failed’)

Example:

proxy→server:

  1. {
  2. "request": "proxy config",
  3. "host": "Proxy #12",
  4. "version":"3.4.0"
  5. }

server→proxy:

  1. {
  2. "globalmacro":{
  3. "fields":[
  4. "globalmacroid",
  5. "macro",
  6. "value"
  7. ],
  8. "data":[
  9. [
  10. 2,
  11. "{$SNMP_COMMUNITY}",
  12. "public"
  13. ]
  14. ]
  15. },
  16. "hosts":{
  17. "fields":[
  18. "hostid",
  19. "host",
  20. "status",
  21. "ipmi_authtype",
  22. "ipmi_privilege",
  23. "ipmi_username",
  24. "ipmi_password",
  25. "name",
  26. "tls_connect",
  27. "tls_accept",
  28. "tls_issuer",
  29. "tls_subject",
  30. "tls_psk_identity",
  31. "tls_psk"
  32. ],
  33. "data":[
  34. [
  35. 10001,
  36. "Template OS Linux",
  37. 3,
  38. -1,
  39. 2,
  40. "",
  41. "",
  42. "Template OS Linux",
  43. 1,
  44. 1,
  45. "",
  46. "",
  47. "",
  48. ""
  49. ],
  50. [
  51. 10050,
  52. "Template App Zabbix Agent",
  53. 3,
  54. -1,
  55. 2,
  56. "",
  57. "",
  58. "Template App Zabbix Agent",
  59. 1,
  60. 1,
  61. "",
  62. "",
  63. "",
  64. ""
  65. ],
  66. [
  67. 10105,
  68. "Logger",
  69. 0,
  70. -1,
  71. 2,
  72. "",
  73. "",
  74. "Logger",
  75. 1,
  76. 1,
  77. "",
  78. "",
  79. "",
  80. ""
  81. ]
  82. ]
  83. },
  84. "interface":{
  85. "fields":[
  86. "interfaceid",
  87. "hostid",
  88. "main",
  89. "type",
  90. "useip",
  91. "ip",
  92. "dns",
  93. "port",
  94. "bulk"
  95. ],
  96. "data":[
  97. [
  98. 2,
  99. 10105,
  100. 1,
  101. 1,
  102. 1,
  103. "127.0.0.1",
  104. "",
  105. "10050",
  106. 1
  107. ]
  108. ]
  109. },
  110. ...
  111. }

proxy→server:

  1. {
  2. "response": "success"
  3. }
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.

namevalue typedescription
proxy→server:
requeststring‘proxy data’
hoststringthe proxy name
host availabilityarray(optional) array of host availability data objects
hostidnumberhost identifier
availablenumberZabbix agent availability

0, HOSTAVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
errorstringZabbix agent error message or empty string
snmp_availablenumberSNMP agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
snmp_errorstringSNMP agent error message or empty string
ipmi_availablenumberIPMI agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
ipmi_errorstringIPMI agent error message or empty string
jmx_availablenumberJMX agent availability

0, HOST_AVAILABLE_UNKNOWN - unknown
1, HOST_AVAILABLE_TRUE - available
2, HOST_AVAILABLE_FALSE - unavailable
jmx_errorstringJMX agent error message or empty string
history dataarray(optional) array of history data objects
itemidnumberitem identifier
clocknumberitem value timestamp (seconds)
nsnumberitem value timestamp (nanoseconds)
valuestring(optional) item value
timestampnumber(optional) timestamp of log type items
sourcestring(optional) eventlog item source value
severitynumber(optional) eventlog item severity value
eventidnumber(optional) eventlog item eventid value
statestring(optional) item state
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsizenumber(optional) last logs ize of log type items
mtimenumber(optional) modify time of log type items
discovery dataarray(optional) array of discovery data objects
clocknumberthe discovery data timestamp
druleidnumberthe discovery rule identifier
dcheckidnumberthe discovery check indentifier or null for discovery rule data
typenumberthe 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
ipstringthe host IP address
dnsstringthe host DNS name
portnumber(optional) service port number
keystring(optional) the item key for discovery check of type 9 SVC_AGENT
valuestring(optional) value received from the service, can be empty for most of services
statusnumber(optional) service status:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registrationarray(optional) array of auto registration data objects
clocknumberthe auto registration data timestamp
hoststringthe host name
ipstring(optional) the host IP address
dnsstring(optional) the resolved DNS name from IP address
portstring(optional) the host port
host_metadatastring(optional) the host metadata sent by agent (based on HostMetadata or HostMetadataItem agent configuration parameter)
tasksarray(optional) array of tasks
typenumberthe task type:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - remote command result
statusnumberthe 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
errorstring(optional) the error message
parent_taskidnumberthe parent task id
morenumber(optional) 1 - there are more history data to send
clocknumberdata transfer timestamp (seconds)
nsnumberdata transfer timestamp (nanoseconds)
versionstringthe proxy version (<major>.<minor>.<build>)
server→proxy:
responsestringthe request success information (‘success’ or ‘failed’)
tasksarray(optional) array of tasks
typenumberthe task type:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - remote command
clocknumberthe task creation time
ttlnumberthe time in seconds after which task expires
commandtypenumberthe 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)
commandstringthe remote command to execute
execute_onnumberthe 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
portnumber(optional) the port for telnet and ssh commands
authtypenumber(optional) the authentication type for ssh commands
usernamestring(optional) the user name for telnet and ssh commands
passwordstring(optional) the password for telnet and ssh commands
publickeystring(optional) the public key for ssh commands
privatekeystring(optional) the private key for ssh commands
parent_taskidnumberthe parent task id
hostidnumbertarget hostid

Example:

proxy→server:

  1. {
  2. "request": "proxy data",
  3. "host": "Proxy #12",
  4. "host availability":[
  5. {
  6. "hostid":10106,
  7. "available":1,
  8. "error":"",
  9. "snmp_available":0,
  10. "snmp_error":"",
  11. "ipmi_available":0,
  12. "ipmi_error":"",
  13. "jmx_available":0,
  14. "jmx_error":""
  15. },
  16. {
  17. "hostid":10107,
  18. "available":1,
  19. "error":"",
  20. "snmp_available":0,
  21. "snmp_error":"",
  22. "ipmi_available":0,
  23. "ipmi_error":"",
  24. "jmx_available":0,
  25. "jmx_error":""
  26. }
  27. ],
  28. "history data":[
  29. {
  30. "itemid":"12345",
  31. "clock":1478609647,
  32. "ns":332510044,
  33. "value":"52956612"
  34. },
  35. {
  36. "itemid":"12346",
  37. "clock":1478609647,
  38. "ns":330690279,
  39. "state":1,
  40. "value":"Cannot find information for this network interface in /proc/net/dev."
  41. }
  42. ],
  43. "discovery data":[
  44. {
  45. "clock":1478608764,
  46. "drule":2,
  47. "dcheck":3,
  48. "type":12,
  49. "ip":"10.3.0.10",
  50. "dns":"vdebian",
  51. "status":1
  52. },
  53. {
  54. "clock":1478608764,
  55. "drule":2,
  56. "dcheck":null,
  57. "type":-1,
  58. "ip":"10.3.0.10",
  59. "dns":"vdebian",
  60. "status":1
  61. }
  62. ],
  63. "auto registration":[
  64. {
  65. "clock":1478608371,
  66. "host":"Logger1",
  67. "ip":"10.3.0.1",
  68. "dns":"localhost",
  69. "port":"10050"
  70. },
  71. {
  72. "clock":1478608381,
  73. "host":"Logger2",
  74. "ip":"10.3.0.2",
  75. "dns":"localhost",
  76. "port":"10050"
  77. }
  78. ],
  79. "tasks":[
  80. {
  81. "type": 2,
  82. "clock":1478608371,
  83. "ttl": 600,
  84. "commandtype": 2,
  85. "command": "restart_service1.sh",
  86. "execute_on": 2,
  87. "port": 80,
  88. "authtype": 0,
  89. "username": "userA",
  90. "password": "password1",
  91. "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
  92. "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
  93. "parent_taskid": 10,
  94. "hostid": 10070
  95. },
  96. {
  97. "type": 2,
  98. "clock":1478608381,
  99. "ttl": 600,
  100. "commandtype": 1,
  101. "command": "restart_service2.sh",
  102. "execute_on": 0,
  103. "authtype": 0,
  104. "username": "",
  105. "password": "",
  106. "publickey": "",
  107. "privatekey": "",
  108. "parent_taskid": 20,
  109. "hostid": 10084
  110. }
  111. ],
  112. "tasks":[
  113. {
  114. "type": 0,
  115. "status": 0,
  116. "parent_taskid": 10
  117. },
  118. {
  119. "type": 0,
  120. "status": 1,
  121. "error": "No permissions to execute task.",
  122. "parent_taskid": 20
  123. }
  124. ],
  125. "clock":1478609648,
  126. "ns":157729208,
  127. "version":"3.4.0"
  128. }

server→proxy:

  1. {
  2. "response": "success",
  3. "tasks":[
  4. {
  5. "type": 1,
  6. "clock": 1478608371,
  7. "ttl": 600,
  8. "commandtype": 2,
  9. "command": "restart_service1.sh",
  10. "execute_on": 2,
  11. "port": 80,
  12. "authtype": 0,
  13. "username": "userA",
  14. "password": "password1",
  15. "publickey": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCqGKukO1De7zhZj6+H0qtjTkVxwTCpvKe",
  16. "privatekey": "lsuusFncCzWBQ7RKNUSesmQRMSGkVb1/3j+skZ6UtW+5u09lHNsj6tQ5QCqGKukO1De7zhd",
  17. "parent_taskid": 10,
  18. "hostid": 10070
  19. },
  20. {
  21. "type": 1,
  22. "clock": 1478608381,
  23. "ttl": 600,
  24. "commandtype": 1,
  25. "command": "restart_service2.sh",
  26. "execute_on": 0,
  27. "authtype": 0,
  28. "username": "",
  29. "password": "",
  30. "publickey": "",
  31. "privatekey": "",
  32. "parent_taskid": 20,
  33. "hostid": 10084
  34. }
  35. ]
  36. }

Backwards compatibility

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