1 Server-proxy 数据交换协议

概述

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

请求和响应消息必须以header头部与数据长度开头。

被动代理

配置请求

服务器将第一时间发送一个空的 proxy config 请求。此请求每隔 ProxyConfigFrequency (服务器配置参数) 秒发送一次。

Proxy 以当前 Proxy 版本、会话令牌和配置修改进行响应。服务器以需要更新的配置数据进行响应。

名称 值类型 描述
server→proxy:
request string 'proxy config'
proxy→server:
version string Proxy 版本 (<major>.<minor>.<build>).
session string Proxy 配置会话令牌.
config_revision number Proxy 配置修订.
server→proxy:
full_sync number 1 - 如果发送完整配置数据; 空 - 其他情况 (可选).
data array 表数据对象.如果配置未更改则为空(可选).
<table> object 一个或多个 <table> 对象数据 (可选, 取决于变化).
fields array 字段名称数组.
- string 字段名称.
data array 行数组.
- array 列数组.
- string,number 列值的类型取决于数据库中的列类型.
macro.secrets object Secret宏信息,如果vault宏未发生更改,则为空(可选).
config_revision number 配置缓存修订 - 与配置数据一起发送 (可选).
del_hostids array 已删除的hostid数组 (可选).
- number 主机标识符.
del_macro_hostids array 删除的所有宏的hostid数组 (可选).
- number 主机标识符.
proxy→server:
response string 请求成功信息 ('success' or 'failed').
version string Proxy版本 (<major>.<minor>.<build>).

例子:

server→proxy:

server→proxy:

{
         "request":"proxy config"
       } 

proxy→server:

{
         "version": "7.0.0",
         "session": "0033124949800811e5686dbfd9bcea98",
         "config_revision": 0
       }

server→proxy:

{
           "full_sync": 1,
           "data": {
               "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": [
                       [10084, "Zabbix server", 0, -1, 2, "", "", "Zabbix server", 1, 1, "", "", "", ""]
                   ]
               },
               "interface": {
                   "fields": ["interfaceid", "hostid", "main", "type", "useip", "ip", "dns", "port", "available"],
                   "data": [
                       [1, 10084, 1, 1, 1, "127.0.0.1", "", "10053", 1]
                   ]
               },
               "interface_snmp": {
                   "fields": ["interfaceid", "version", "bulk", "community", "securityname", "securitylevel", "authpassphrase", "privpassphrase", "authprotocol", "privprotocol", "contextname"],
                   "data": []
               },
               "host_inventory": {
                   "fields": ["hostid", "type", "type_full", "name", "alias", "os", "os_full", "os_short", "serialno_a", "serialno_b", "tag", "asset_tag", "macaddress_a", "macaddress_b", "hardware", "hardware_full", "software", "software_full", "software_app_a", "software_app_b", "software_app_c", "software_app_d", "software_app_e", "contact", "location", "location_lat", "location_lon", "notes", "chassis", "model", "hw_arch", "vendor", "contract_number", "installer_name", "deployment_status", "url_a", "url_b", "url_c", "host_networks", "host_netmask", "host_router", "oob_ip", "oob_netmask", "oob_router", "date_hw_purchase", "date_hw_install", "date_hw_expiry", "date_hw_decomm", "site_address_a", "site_address_b", "site_address_c", "site_city", "site_state", "site_country", "site_zip", "site_rack", "site_notes", "poc_1_name", "poc_1_email", "poc_1_phone_a", "poc_1_phone_b", "poc_1_cell", "poc_1_screen", "poc_1_notes", "poc_2_name", "poc_2_email", "poc_2_phone_a", "poc_2_phone_b", "poc_2_cell", "poc_2_screen", "poc_2_notes"],
                   "data": [
                       [10084, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "56.95387", "24.22067", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
                   ]
               },
               "items": {
                   "fields": ["itemid", "type", "snmp_oid", "hostid", "key_", "delay", "history", "status", "value_type", "trapper_hosts", "logtimefmt", "params", "ipmi_sensor", "authtype", "username", "password", "publickey", "privatekey", "flags", "interfaceid", "inventory_link", "jmx_endpoint", "master_itemid", "timeout", "url", "query_fields", "posts", "status_codes", "follow_redirects", "post_type", "http_proxy", "headers", "retrieve_mode", "request_method", "output_format", "ssl_cert_file", "ssl_key_file", "ssl_key_password", "verify_peer", "verify_host", "allow_traps"],
                   "data": [
                       [44161, 7, "", 10084, "agent.hostmetadata", "10s", "90d", 0, 1, "", "", "", "", 0, "", "", "", "", 0, null, 0, "", null, "3s", "", "", "", "200", 1, 0, "", "", 0, 0, 0, "", "", "", 0, 0, 0],
                       [44162, 0, "", 10084, "agent.ping", "10s", "90d", 0, 3, "", "", "", "", 0, "", "", "", "", 0, 1, 0, "", null, "3s", "", "", "", "200", 1, 0, "", "", 0, 0, 0, "", "", "", 0, 0, 0]
                   ]
               },
               "item_rtdata": {
                   "fields": ["itemid", "lastlogsize", "mtime"],
                   "data": [
                       [44161, 0, 0],
                       [44162, 0, 0]
                   ]
               },
               "item_preproc": {
                   "fields": ["item_preprocid", "itemid", "step", "type", "params", "error_handler", "error_handler_params"],
                   "data": []
               },
               "item_parameter": {
                   "fields": ["item_parameterid", "itemid", "name", "value"],
                   "data": []
               },
               "globalmacro": {
                   "fields": ["globalmacroid", "macro", "value", "type"],
                   "data": [
                       [2, "{$SNMP_COMMUNITY}", "public", 0]
                   ]
               },
               "hosts_templates": {
                   "fields": ["hosttemplateid", "hostid", "templateid", "link_type"],
                   "data": []
               },
               "hostmacro": {
                   "fields": ["hostmacroid", "hostid", "macro", "value", "type", "automatic"],
                   "data": [
                       [5676, 10084, "{$M}", "AppID=zabbix_server&Query=Safe=passwordSafe;Object=zabbix:Content", 2, 0]
                   ]
               },
               "drules": {
                   "fields": ["druleid", "name", "iprange", "delay"],
                   "data": [
                       [2, "Local network", "127.0.0.1", "10s"]
                   ]
               },
               "dchecks": {
                   "fields": ["dcheckid", "druleid", "type", "key_", "snmp_community", "ports", "snmpv3_securityname", "snmpv3_securitylevel", "snmpv3_authpassphrase", "snmpv3_privpassphrase", "uniq", "snmpv3_authprotocol", "snmpv3_privprotocol", "snmpv3_contextname", "host_source", "name_source"],
                   "data": [
                       [2, 2, 9, "system.uname", "", "10052", "", 0, "", "", 0, 0, 0, "", 1, 0]
                   ]
               },
               "regexps": {
                   "fields": ["regexpid", "name"],
                   "data": [
                       [1, "File systems for discovery"],
                       [2, "Network interfaces for discovery"],
                       [3, "Storage devices for SNMP discovery"],
                       [4, "Windows service names for discovery"],
                       [5, "Windows service startup states for discovery"]
                   ]
               },
               "expressions": {
                   "fields": ["expressionid", "regexpid", "expression", "expression_type", "exp_delimiter", "case_sensitive"],
                   "data": [
                       [1, 1, "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$", 3, ",", 0],
                       [3, 3, "^(Physical memory|Virtual memory|Memory buffers|Cached memory|Swap space)$", 4, ",", 1],
                       [5, 4, "^(MMCSS|gupdate|SysmonLog|clr_optimization_v2.0.50727_32|clr_optimization_v4.0.30319_32)$", 4, ",", 1],
                       [6, 5, "^(automatic|automatic delayed)$", 3, ",", 1],
                       [7, 2, "^Software Loopback Interface", 4, ",", 1],
                       [8, 2, "^(In)?[Ll]oop[Bb]ack[0-9._]*$", 4, ",", 1],
                       [9, 2, "^NULL[0-9.]*$", 4, ",", 1],
                       [10, 2, "^[Ll]o[0-9.]*$", 4, ",", 1],
                       [11, 2, "^[Ss]ystem$", 4, ",", 1],
                       [12, 2, "^Nu[0-9.]*$", 4, ",", 1]
                   ]
               },
               "config": {
                   "fields": ["configid", "snmptrap_logging", "hk_history_global", "hk_history", "autoreg_tls_accept"],
                   "data": [
                       [1, 1, 0, "90d", 1]
                   ]
               },
               "httptest": {
                   "fields": ["httptestid", "name", "delay", "agent", "authentication", "http_user", "http_password", "hostid", "http_proxy", "retries", "ssl_cert_file", "ssl_key_file", "ssl_key_password", "verify_peer", "verify_host"],
                   "data": []
               },
               "httptestitem": {
                   "fields": ["httptestitemid", "httptestid", "itemid", "type"],
                   "data": []
               },
               "httptest_field": {
                   "fields": ["httptest_fieldid", "httptestid", "type", "name", "value"],
                   "data": []
               },
               "httpstep": {
                   "fields": ["httpstepid", "httptestid", "name", "no", "url", "timeout", "posts", "required", "status_codes", "follow_redirects", "retrieve_mode", "post_type"],
                   "data": []
               },
               "httpstepitem": {
                   "fields": ["httpstepitemid", "httpstepid", "itemid", "type"],
                   "data": []
               },
               "httpstep_field": {
                   "fields": ["httpstep_fieldid", "httpstepid", "type", "name", "value"],
                   "data": []
               },
               "config_autoreg_tls": {
                   "fields": ["autoreg_tlsid", "tls_psk_identity", "tls_psk"],
                   "data": [
                       [1, "", ""]
                   ]
               }
           },
           "macro.secrets": {
               "AppID=zabbix_server&Query=Safe=passwordSafe;Object=zabbix": {
                   "Content": "738"
               }
           },
           "config_revision": 2
       }

proxy→server:

{
         "response": "success",
         "version": "7.0.0"
       }
数据请求

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

名称 值类型 描述
server→proxy:
request string 'proxy data'
proxy→server:
session string 数据会话令牌.
interface availability array (可选) 接口可用性数据对象数组.
interfaceid number 接口标识符.
available number 接口可用性:

0, INTERFACE_AVAILABLE_UNKNOWN - 未知
1, INTERFACE_AVAILABLE_TRUE - 可用
2, INTERFACE_AVAILABLE_FALSE - 不可用
error string 接口错误消息或空字符串.
history data array (可选) 历史数据对象数组.
itemid number 监控项标识符.
clock number 监控项值时间戳 (秒).
ns number 监控项值时间戳 (纳秒).
value string (可选) 监控项值.
id number 值标识符 (自增id, 在一个数据会话中是唯一的).
timestamp number (可选) 日志类型监控项的时间戳.
source string (可选) 事件日志监控项源值.
severity number (可选) 事件日志监控项严重性值.
eventid number (可选) 事件日志监控项事件id值.
state string (可选) 监控项状态:
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsize number (可选) 日志类型监控项最近的日志大小.
mtime number (可选) 日志类型监控项的修改时间.
discovery data array (可选) 自动发现数据对象数组.
clock number 自动发现数据时间戳.
druleid number 自动发现规则id.
dcheckid number 自动发现检查标识符或自动发现规则数据为空.
type number 自动发现检查类型:

-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 主机IP地址.
dns string 主机DNS名称.
port number (可选) 服务端口号.
key_ string (可选) 用于自动发现检查的监控项键 9 SVC_AGENT
value string (可选) 从服务接收的值, 对于大多数服务可以为空.
status number (可选) 服务状态:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
auto registration array (可选) 自动注册数据对象数组.
clock number 自动注册数据时间戳.
host string 主机名.
ip string (可选) 主机IP地址.
dns string (可选) DNS.
port string (可选) 主机端口.
host_metadata string (可选) agent发送的主机元数据 (基于HostMetadata或HostMetadataItem agent配置参数).
tasks array (可选) 任务数组.
type number 任务类型:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - 远程命令结果
status number 远程命令执行状态:

0, ZBX_TM_REMOTE_COMMAND_COMPLETED - 远程命令执行成功
1, ZBX_TM_REMOTE_COMMAND_FAILED - 远程命令失败
error string (可选) 错误信息.
parent_taskid number 父任务ID.
more number (可选) 1 - 还有更多历史数据要发送.
clock number (可选) 数据传输时间戳 (秒).
ns number (可选) 数据传输时间戳 (纳秒).
version string Proxy 版本 (<major>.<minor>.<build>).
server→proxy:
response string 请求成功信息 ('success' or 'failed').
tasks array (可选) 任务数组.
type number 任务类型:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - 远程命令
clock number 任务创建时间.
ttl number 任务过期时间(以秒为单位).
commandtype number 远程命令类型:

0, ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT - 使用自定义脚本
1, ZBX_SCRIPT_TYPE_IPMI - 使用IPMI
2, ZBX_SCRIPT_TYPE_SSH - 使用SSH
3, ZBX_SCRIPT_TYPE_TELNET - 使用Telnet
4, ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT - 使用全局脚本 (目前功能相当于自定义脚本)
command string 要执行的远程命令.
execute_on number 自定义脚本的执行目标:

0, ZBX_SCRIPT_EXECUTE_ON_AGENT - 在agent上执行脚本
1, ZBX_SCRIPT_EXECUTE_ON_SERVER - 在server上执行脚本
2, ZBX_SCRIPT_EXECUTE_ON_PROXY - 在proxy上执行脚本
port number (可选) Telnet和SSH命令端口.
authtype number (可选) SSH命令的身份认证方式.
username string (可选) Telnet和SSH命令的用户名.
password string (可选) Telnet和SSH命令的密码.
publickey string (可选) SSH命令的公钥.
privatekey string (可选) SSH命令的私钥.
parent_taskid number 父任务ID.
hostid number 目标hostid.

例子:

server→proxy:

{
         "request": "proxy data"
       }

proxy→server:

{
           "session": "12345678901234567890123456789012"
           "interface availability": [
               {
                   "interfaceid": 1,
                   "available": 1,
                   "error": ""
           },
               {
                   "interfaceid": 2,
                   "available": 2,
                   "error": "Get value from agent failed: cannot connect to [[127.0.0.1]:10049]: [111] Connection refused"
           },
               {
                   "interfaceid": 3,
                   "available": 1,
                   "error": ""
           },
               {
                   "interfaceid": 4,
                   "available": 1,
                   "error": ""
           }
           ],
           "history data":[
               {
                   "itemid":"12345",
                   "clock":1478609647,
                   "ns":332510044,
                   "value":"52956612",
                   "id": 1
               },
               {
                   "itemid":"12346",
                   "clock":1478609647,
                   "ns":330690279,
                   "state":1,
                   "value":"Cannot find information for this network interface in /proc/net/dev.",
                   "id": 2
               }
           ],
           "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
               }
           ],
           "version":"7.0.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 发送 proxy config 请求获取proxy配置数据。此请求每隔 ProxyConfigFrequency (proxy配置参数) 秒发送一次.

名称 值类型 描述
proxy→server:
request string 'proxy config'
host string
Proxy名称.
version string Proxy版本 (<major>.<minor>.<build>).
session string Proxy配置会话令牌.
config_revision number Proxy配置修订.
server→proxy:
fullsync number 1 - 如果发送完整的配置数据, 否则为空 (可选).
data array 表数据对象. 如果配置数据未发生变化则为空 (可选).
<table> object 一个或多个 <table> 数据对象 (可选, 取决于变化).
fields array 字段名称数组.
- string 字段名称.
data array 行数组.
- array 列数组.
- string,number 列值的类型取决于数据库模式中的列类型.
macro.secrets object Secret宏信息, 如果在vault宏中未发生变化则为空 (可选).
config_revision number 配置缓存修订 - 与配置数据一起发送 (可选).
del_hostids array 已删除的hostid数组 (可选).
- number 主机标识符.
del_macro_hostids array 删除所有宏的主机id数组 (可选).
- number 主机标识符.

例子:

proxy→server:

{
         "request": "proxy config",
         "host": "Zabbix proxy",
         "version":"7.0.0",
         "session": "fd59a09ff4e9d1fb447de1f04599bcf6",
         "config_revision": 0
       }

server→proxy:

{
           "full_sync": 1,
           "data": {
               "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": [
                       [10084, "Zabbix server", 0, -1, 2, "", "", "Zabbix server", 1, 1, "", "", "", ""]
                   ]
               },
               "interface": {
                   "fields": ["interfaceid", "hostid", "main", "type", "useip", "ip", "dns", "port", "available"],
                   "data": [
                       [1, 10084, 1, 1, 1, "127.0.0.1", "", "10053", 1]
                   ]
               },
               "interface_snmp": {
                   "fields": ["interfaceid", "version", "bulk", "community", "securityname", "securitylevel", "authpassphrase", "privpassphrase", "authprotocol", "privprotocol", "contextname"],
                   "data": []
               },
               "host_inventory": {
                   "fields": ["hostid", "type", "type_full", "name", "alias", "os", "os_full", "os_short", "serialno_a", "serialno_b", "tag", "asset_tag", "macaddress_a", "macaddress_b", "hardware", "hardware_full", "software", "software_full", "software_app_a", "software_app_b", "software_app_c", "software_app_d", "software_app_e", "contact", "location", "location_lat", "location_lon", "notes", "chassis", "model", "hw_arch", "vendor", "contract_number", "installer_name", "deployment_status", "url_a", "url_b", "url_c", "host_networks", "host_netmask", "host_router", "oob_ip", "oob_netmask", "oob_router", "date_hw_purchase", "date_hw_install", "date_hw_expiry", "date_hw_decomm", "site_address_a", "site_address_b", "site_address_c", "site_city", "site_state", "site_country", "site_zip", "site_rack", "site_notes", "poc_1_name", "poc_1_email", "poc_1_phone_a", "poc_1_phone_b", "poc_1_cell", "poc_1_screen", "poc_1_notes", "poc_2_name", "poc_2_email", "poc_2_phone_a", "poc_2_phone_b", "poc_2_cell", "poc_2_screen", "poc_2_notes"],
                   "data": [
                       [10084, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "56.95387", "24.22067", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
                   ]
               },
               "items": {
                   "fields": ["itemid", "type", "snmp_oid", "hostid", "key_", "delay", "history", "status", "value_type", "trapper_hosts", "logtimefmt", "params", "ipmi_sensor", "authtype", "username", "password", "publickey", "privatekey", "flags", "interfaceid", "inventory_link", "jmx_endpoint", "master_itemid", "timeout", "url", "query_fields", "posts", "status_codes", "follow_redirects", "post_type", "http_proxy", "headers", "retrieve_mode", "request_method", "output_format", "ssl_cert_file", "ssl_key_file", "ssl_key_password", "verify_peer", "verify_host", "allow_traps"],
                   "data": [
                       [44161, 7, "", 10084, "agent.hostmetadata", "10s", "90d", 0, 1, "", "", "", "", 0, "", "", "", "", 0, null, 0, "", null, "3s", "", "", "", "200", 1, 0, "", "", 0, 0, 0, "", "", "", 0, 0, 0],
                       [44162, 0, "", 10084, "agent.ping", "10s", "90d", 0, 3, "", "", "", "", 0, "", "", "", "", 0, 1, 0, "", null, "3s", "", "", "", "200", 1, 0, "", "", 0, 0, 0, "", "", "", 0, 0, 0]
                   ]
               },
               "item_rtdata": {
                   "fields": ["itemid", "lastlogsize", "mtime"],
                   "data": [
                       [44161, 0, 0],
                       [44162, 0, 0]
                   ]
               },
               "item_preproc": {
                   "fields": ["item_preprocid", "itemid", "step", "type", "params", "error_handler", "error_handler_params"],
                   "data": []
               },
               "item_parameter": {
                   "fields": ["item_parameterid", "itemid", "name", "value"],
                   "data": []
               },
               "globalmacro": {
                   "fields": ["globalmacroid", "macro", "value", "type"],
                   "data": [
                       [2, "{$SNMP_COMMUNITY}", "public", 0]
                   ]
               },
               "hosts_templates": {
                   "fields": ["hosttemplateid", "hostid", "templateid", "link_type"],
                   "data": []
               },
               "hostmacro": {
                   "fields": ["hostmacroid", "hostid", "macro", "value", "type", "automatic"],
                   "data": [
                       [5676, 10084, "{$M}", "AppID=zabbix_server&Query=Safe=passwordSafe;Object=zabbix:Content", 2, 0]
                   ]
               },
               "drules": {
                   "fields": ["druleid", "name", "iprange", "delay"],
                   "data": [
                       [2, "Local network", "127.0.0.1", "10s"]
                   ]
               },
               "dchecks": {
                   "fields": ["dcheckid", "druleid", "type", "key_", "snmp_community", "ports", "snmpv3_securityname", "snmpv3_securitylevel", "snmpv3_authpassphrase", "snmpv3_privpassphrase", "uniq", "snmpv3_authprotocol", "snmpv3_privprotocol", "snmpv3_contextname", "host_source", "name_source"],
                   "data": [
                       [2, 2, 9, "system.uname", "", "10052", "", 0, "", "", 0, 0, 0, "", 1, 0]
                   ]
               },
               "regexps": {
                   "fields": ["regexpid", "name"],
                   "data": [
                       [1, "File systems for discovery"],
                       [2, "Network interfaces for discovery"],
                       [3, "Storage devices for SNMP discovery"],
                       [4, "Windows service names for discovery"],
                       [5, "Windows service startup states for discovery"]
                   ]
               },
               "expressions": {
                   "fields": ["expressionid", "regexpid", "expression", "expression_type", "exp_delimiter", "case_sensitive"],
                   "data": [
                       [1, 1, "^(btrfs|ext2|ext3|ext4|reiser|xfs|ffs|ufs|jfs|jfs2|vxfs|hfs|apfs|refs|ntfs|fat32|zfs)$", 3, ",", 0],
                       [3, 3, "^(Physical memory|Virtual memory|Memory buffers|Cached memory|Swap space)$", 4, ",", 1],
                       [5, 4, "^(MMCSS|gupdate|SysmonLog|clr_optimization_v2.0.50727_32|clr_optimization_v4.0.30319_32)$", 4, ",", 1],
                       [6, 5, "^(automatic|automatic delayed)$", 3, ",", 1],
                       [7, 2, "^Software Loopback Interface", 4, ",", 1],
                       [8, 2, "^(In)?[Ll]oop[Bb]ack[0-9._]*$", 4, ",", 1],
                       [9, 2, "^NULL[0-9.]*$", 4, ",", 1],
                       [10, 2, "^[Ll]o[0-9.]*$", 4, ",", 1],
                       [11, 2, "^[Ss]ystem$", 4, ",", 1],
                       [12, 2, "^Nu[0-9.]*$", 4, ",", 1]
                   ]
               },
               "config": {
                   "fields": ["configid", "snmptrap_logging", "hk_history_global", "hk_history", "autoreg_tls_accept"],
                   "data": [
                       [1, 1, 0, "90d", 1]
                   ]
               },
               "httptest": {
                   "fields": ["httptestid", "name", "delay", "agent", "authentication", "http_user", "http_password", "hostid", "http_proxy", "retries", "ssl_cert_file", "ssl_key_file", "ssl_key_password", "verify_peer", "verify_host"],
                   "data": []
               },
               "httptestitem": {
                   "fields": ["httptestitemid", "httptestid", "itemid", "type"],
                   "data": []
               },
               "httptest_field": {
                   "fields": ["httptest_fieldid", "httptestid", "type", "name", "value"],
                   "data": []
               },
               "httpstep": {
                   "fields": ["httpstepid", "httptestid", "name", "no", "url", "timeout", "posts", "required", "status_codes", "follow_redirects", "retrieve_mode", "post_type"],
                   "data": []
               },
               "httpstepitem": {
                   "fields": ["httpstepitemid", "httpstepid", "itemid", "type"],
                   "data": []
               },
               "httpstep_field": {
                   "fields": ["httpstep_fieldid", "httpstepid", "type", "name", "value"],
                   "data": []
               },
               "config_autoreg_tls": {
                   "fields": ["autoreg_tlsid", "tls_psk_identity", "tls_psk"],
                   "data": [
                       [1, "", ""]
                   ]
               }
           },
           "macro.secrets": {
               "AppID=zabbix_server&Query=Safe=passwordSafe;Object=zabbix": {
                   "Content": "738"
               }
           },
           "config_revision": 2
       }
数据请求

proxy data 请求由 proxy 发送,以提供主机接口可用性、历史、发现和自动注册的数据. 此请求每隔 DataSenderFrequency ( proxy 配置参数) 秒发送一次. 注意主动 proxy 仍会每秒轮询 Zabbix server 以获取远程命令任务 (使用空的proxy data 请求).

名称 值类型 描述
proxy→server:
request string 'proxy data'
host string Proxy名称.
session string 数据会话令牌.
interface availability array (可选) 接口可用性数据对象数组.
interfaceid number 接口标识符.
available number 接口可用性:

0, INTERFACE_AVAILABLE_UNKNOWN - 未知
1, INTERFACE_AVAILABLE_TRUE - 可用
2, INTERFACE_AVAILABLE_FALSE - 不可用
error string 接口错误消息或空字符串.
history data array (可选) 历史数据对象数组.
itemid number 监控项标识符.
clock number 监控项值时间戳 (秒).
ns number 监控项值时间戳 (纳秒).
value string (可选) 监控项值.
id number 值标识符 (自增id, 在一个数据会话中是唯一的).
timestamp number (可选) 日志类型监控项的时间戳.
source string (可选) 事件日志监控项源值.
severity number (可选) 事件日志监控项严重性值.
eventid number (可选) 事件日志监控项事件id值.
state string (可选) 监控项状态:
0, ITEM_STATE_NORMAL
1, ITEM_STATE_NOTSUPPORTED
lastlogsize number (可选) 日志类型监控项最近的日志大小.
mtime number (可选) 日志类型监控项的修改时间.
discovery data array (可选) 自动发现数据对象数组.
clock number 自动发现数据时间戳.
druleid number 自动发现规则id.
dcheckid number 自动发现检查标识符或自动发现规则数据为空.
type number 自动发现检查类型:

-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 主机IP地址.
dns string 主机DNS名称.
port number (可选) 服务端口号.
key_ string (可选) 用于自动发现检查的监控项键 9 SVC_AGENT
value string (可选) 从服务接收的值, 对于大多数服务可以为空.
status number (可选) 服务状态:

0, DOBJECT_STATUS_UP - Service UP
1, DOBJECT_STATUS_DOWN - Service DOWN
autoregistration array (可选) 自动注册数据对象数组.
clock number 自动注册数据时间戳.
host string 主机名.
ip string (可选) 主机IP地址.
dns string (可选) 主机DNS名称.
port string (可选) 主机端口.
host_metadata string (可选) agent发送的主机元数据 (基于HostMetadata或HostMetadataItem agent配置参数).
tasks array (可选) 任务数组.
type number 任务类型:

0, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND_RESULT - 远程命令结果
status number 远程命令执行状态:

0, ZBX_TM_REMOTE_COMMAND_COMPLETED - 远程命令执行成功
1, ZBX_TM_REMOTE_COMMAND_FAILED - 远程命令失败
error string (可选) 错误信息.
parent_taskid number 父任务ID.
more number (可选) 1 - 还有更多历史数据要发送
clock number (可选) 数据传输时间戳 (秒).
ns number (optional) 数据传输时间戳 (纳秒).
version string Proxy版本 (<major>.<minor>.<build>).
server→proxy:
response string 请求成功信息 ('success' or 'failed').
upload string 历史数据的上传控制(历史、自动注册、主机可用性、网络自动发现).

可能的值:
enabled - 正常操作
disabled - 服务器不接受数据(可能是由于内部缓存超出限制)
tasks array (可选) 任务数组.
type number 任务类型:

1, ZBX_TM_TASK_PROCESS_REMOTE_COMMAND - 远程命令
clock number 任务创建时间.
ttl number 任务过期时间(以秒为单位).
commandtype number 远程命令类型:

0, ZBX_SCRIPT_TYPE_CUSTOM_SCRIPT - 使用自定义脚本
1, ZBX_SCRIPT_TYPE_IPMI - 使用IPMI
2, ZBX_SCRIPT_TYPE_SSH - 使用SSH
3, ZBX_SCRIPT_TYPE_TELNET - 使用Telnet
4, ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT - 使用全局脚本 (目前功能相当于自定义脚本)
command string 要执行的远程命令.
execute_on number 自定义脚本的执行目标:

0, ZBX_SCRIPT_EXECUTE_ON_AGENT - 在agent上执行脚本
1, ZBX_SCRIPT_EXECUTE_ON_SERVER - 在server上执行脚本
2, ZBX_SCRIPT_EXECUTE_ON_PROXY - 在proxy上执行脚本
port number (可选) Telnet和SSH命令端口.
authtype number (可选) SSH命令的身份认证方式.
username string (可选) Telnet和SSH命令的用户名.
password string (可选) Telnet和SSH命令的密码.
publickey string (可选) SSH命令的公钥.
privatekey string (可选) SSH命令的私钥.
parent_taskid number 父任务ID.
hostid number 目标hostid.

例子:

proxy→server:

{
           "request": "proxy data",
           "host": "Zabbix proxy",
           "session": "818cdd1b537bdc5e50c09ed4969235b6",
           "interface availability": [{
               "interfaceid": 1,
               "available": 1,
               "error": ""
           }],
           "history data": [{
               "id": 1114,
               "itemid": 44162,
               "clock": 1665730632,
               "ns": 798953105,
               "value": "1"
           }, {
               "id": 1115,
               "itemid": 44161,
               "clock": 1665730633,
               "ns": 811684663,
               "value": "58"
           }],
           "auto registration": [{
               "clock": 1665730633,
               "host": "Zabbix server",
               "ip": "127.0.0.1",
               "dns": "localhost",
               "port": "10053",
               "host_metadata": "58",
               "tls_accepted": 1
           }],
           "discovery data": [{
               "clock": 1665732232,
               "drule": 2,
               "dcheck": 2,
               "ip": "127.0.0.1",
               "dns": "localhost",
               "port": 10052,
               "status": 1
           }, {
               "clock": 1665732232,
               "drule": 2,
               "dcheck": null,
               "ip": "127.0.0.1",
               "dns": "localhost",
               "status": 1
           }],
           "host data": [{
               "hostid": 10084,
               "active_status": 1
           }],
           "tasks": [{
               "type": 3,
               "clock": 1665730985,
               "ttl": 0,
               "status": -1,
               "info": "Remote commands are not enabled",
               "parent_taskid": 3
           }],
           "version": "7.0.0",
           "clock": 1665730643,
           "ns": 65389964
       }

server→proxy:

{
           "upload": "enabled",
           "response": "success",
           "tasks": [{
               "type": 2,
               "clock": 1665730986,
               "ttl": 600,
               "commandtype": 0,
               "command": "ping -c 3 127.0.0.1; case $? in [01]) true;; *) false;; esac",
               "execute_on": 2,
               "port": 0,
               "authtype": 0,
               "username": "",
               "password": "",
               "publickey": "",
               "privatekey": "",
               "alertid": 0,
               "parent_taskid": 4,
               "hostid": 10084
           }]
       }