1 服务器-proxy 数据交换协议

概述

服务器 - proxy 数据交换基于 JSON 格式。

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

被动 proxy

配置请求

服务器将首先发送一个空的 proxy config 请求。该请求每隔 ProxyConfigFrequency(服务器配置参数)秒发送一次。

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

名称 值类型 描述
server→proxy:
request string 'proxy config'
proxy→server:
version string Proxy version (<major>.<minor>.<build>)。
session string Proxy 配置会话令牌。
config_revision number Proxy 配置版本。
server→proxy:
full_sync number 1 - 如果发送了完整的配置数据;否则不存在(可选)。
data array 表数据的 object。如果配置未更改,则不存在(可选)。
<table> object 一个或多个包含 <table> 数据的 objects(可选,取决于更改)。
字段 array 字段名的 array。
- string 字段名。
数据 array 行的 array。
- array 列的 array。
- string,number 列值,其类型取决于数据库模式中的列类型。
macro.secrets object 秘密宏信息,如果vault宏没有更改则不存在(可选)。
config_revision number configuration cache 版本 - 随配置数据一起发送(可选)。
del_hostids array 已移除的主机ID的 array(可选)。
- number 主机 标识符。
del_macro_hostids array 所有宏已被移除的主机ID的 array(可选)。
- number 主机 标识符。
proxy→server:
response string 请求成功信息('success' 或 '失败')。
version string Proxy version (<major>.<minor>.<build>)。

示例:

服务器→proxy:

服务器→proxy:

{
         "request":"proxy config"
       } 

proxy→server:

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

server→proxy:

{.javascript}
       {
           "full_sync": 1,
           "data": {
               "主机": {
                   "fields": ["hostid", "主机", "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", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
                   ]
               },
               "监控项": {
                   "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, "本地网络", "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, "用于发现的文件系统"],
                       [2, "用于发现的网络接口"],
                       [3, "用于SNMP发现的存储设备"],
                       [4, "用于发现的Windows服务名称"],
                       [5, "用于发现的Windows服务启动状态"]
                   ]
               },
               "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:

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

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

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

0, INTERFACE_AVAILABLE_UNKNOWN - 未知
1, INTERFACE_AVAILABLE_TRUE - 可用
2, INTERFACE_AVAILABLE_FALSE - 不可用
error string 接口错误消息或空string。
history data array (可选) 历史数据的arrayobjects。
itemid number 监控项标识符。
clock number 监控项值时间戳(秒)。
ns number 监控项值时间戳(纳秒)。
value string (可选) 监控项值。
id number 值标识符(递增计数器,在单个数据会话内唯一)。
timestamp number (可选) 日志类型监控项的时间戳。
source string (可选) 事件日志监控项的源值。
severity number (可选) 事件日志监控项的严重性值。
eventid number (可选) 事件日志监控项的事件ID值。
state string (可选) 监控项状态:
0, 监控项_STATE_NORMAL
1, 监控项_STATE_NOTSUPPORTED
lastlogsize number (可选) 日志类型监控项的最后日志大小。
mtime number (可选) 日志类型监控项的修改时间。
discovery data array (可选) 发现数据的arrayobjects。
clock number 发现数据时间戳。
druleid number 发现规则标识符。
dcheckid number 发现检查标识符或发现规则数据的空值。
type number 发现检查类型:

-1 发现规则数据
0, SVC_SSH - SSH服务检查
1, SVC_LDAP - LDAP服务检查
2, SVC_SMTP - SMTP服务检查
3, SVC_FTP - FTP服务检查
4, SVC_HTTP - HTTP服务检查
5, SVC_POP - POP服务检查
6, SVC_NNTP - NNTP服务检查
7, SVC_IMAP - IMAP服务检查
8, SVC_TCP - TCP端口可用性检查
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服务检查
15, SVC_TELNET - Telnet可用性检查
ip string 主机IP地址。
dns string 主机DNS名称。
port number (可选) 服务端口号。
key_ string (可选) 类型为9 SVC_AGENT的发现检查的监控项键
value string (可选) 从服务接收的值,对于大多数服务可以为空。
status number (可选) 服务状态:

0, DOBJECT_STATUS_UP - 服务运行中
1, DOBJECT_STATUS_DOWN - 服务停止
auto registration array (可选) 自动注册数据的arrayobjects。
clock number 自动注册数据时间戳。
主机 string 主机名。
ip string (可选) 主机IP地址。
dns string (可选) 从IP地址解析的DNS名称。
port string (可选) 主机端口。
主机_metadata string (可选) agent发送的主机元数据(基于HostMetadata或HostMetadataItem agent配置参数)。
tasks array (可选) 任务的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 Proxyversion (<主版本>.<次版本>.<构建号>)。
server→proxy:
response string 请求成功信息('success'或'失败')。
tasks array (可选) 任务的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的远程命令。
execute_on number 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) Port for Telnet and SSH commands.
authtype number (optional) Authentication type for SSH commands.
username string (optional) User name for Telnet and SSH commands.
password string (optional) Password for Telnet and SSH commands.
publickey string (optional) Public key for SSH commands.
privatekey string (optional) Private key for SSH commands.
parent_taskid number 父任务ID。
hostid number 目标主机 ID。

示例:

服务器→proxy:

{
         "request": "proxy data"
       }

proxy→服务器:

{
           "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"
       }

服务器→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 config 请求以获取 proxy 的配置数据。此请求每隔 ProxyConfigFrequency 秒发送一次(proxy 的配置参数)。

名称 值类型 描述
proxy→server:
request string 'proxy config'
host string
Proxy 名称。
version string Proxy version(<主版本>.<次版本>.<构建号>)。
session string Proxy 配置会话令牌。
config_revision number Proxy 配置版本。
server→proxy:
fullsync number 1 - 如果发送了完整的配置数据,则包含此字段,否则省略(可选)。
data array 表数据的object。如果配置未更改,则省略此字段(可选)。
<table> object 一个或多个包含 <table> 数据的 objects(可选,取决于更改情况)。
字段 array 字段名称的array。
- string 字段名称。
数据 array 行的array。
- array 列的array。
- string,number 列值,其类型取决于数据库模式中的列类型。
macro.secrets object 秘密宏信息,如果vault宏没有更改则省略(可选)。
config_revision number configuration cache 版本 - 随配置数据一起发送(可选)。
del_hostids array 已移除的主机ID的array(可选)。
- number 主机 标识符。
del_macro_hostids array 所有宏都被移除的主机ID的array(可选)。
- number 主机 标识符。

示例:

proxy→server:

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

server→proxy:

{.javascript}
       {
           "full_sync": 1,
           "data": {
               "主机": {
                   "fields": ["hostid", "主机", "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", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
                   ]
               },
               "监控项": {
                   "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, "本地网络", "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, "用于发现的文件系统"],
                       [2, "用于发现的网络接口"],
                       [3, "用于SNMP发现的存储设备"],
                       [4, "用于发现的Windows服务名称"],
                       [5, "用于发现的Windows服务启动状态"]
                   ]
               },
               "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数据'
host string Proxy名称。
session string 数据会话令牌。
interface availability array (可选) 接口可用性数据的arrayobjects。
interfaceid number 接口标识符。
available number 接口可用性:

0, INTERFACE_AVAILABLE_UNKNOWN - 未知
1, INTERFACE_AVAILABLE_TRUE - 可用
2, INTERFACE_AVAILABLE_FALSE - 不可用
error string 接口错误消息或空string。
history data array (可选) 历史数据的arrayobjects。
itemid number 监控项标识符。
clock number 监控项值时间戳(秒)。
ns number 监控项值时间戳(纳秒)。
value string (可选) 监控项值。
id number 值标识符(递增计数器,在单个数据会话内唯一)。
timestamp number (可选) 日志类型监控项的时间戳。
source string (可选) 事件日志监控项的源值。
severity number (可选) 事件日志监控项的严重性值。
eventid number (可选) 事件日志监控项的事件ID值。
state string (可选) 监控项状态:
0, 监控项_STATE_NORMAL
1, 监控项_STATE_NOTSUPPORTED
lastlogsize number (可选) 日志类型监控项的最后日志大小。
mtime number (可选) 日志类型监控项的修改时间。
discovery data array (可选) 发现数据的arrayobjects。
clock number 发现数据时间戳。
druleid number 发现规则标识符。
dcheckid number 发现检查标识符,或发现规则数据为null。
type number 发现检查类型:

-1 发现规则数据
0, SVC_SSH - SSH服务检查
1, SVC_LDAP - LDAP服务检查
2, SVC_SMTP - SMTP服务检查
3, SVC_FTP - FTP服务检查
4, SVC_HTTP - HTTP服务检查
5, SVC_POP - POP服务检查
6, SVC_NNTP - NNTP服务检查
7, SVC_IMAP - IMAP服务检查
8, SVC_TCP - TCP端口可用性检查
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服务检查
15, SVC_TELNET - Telnet可用性检查
ip string 主机IP地址。
dns string 主机DNS名称。
port number (可选) 服务端口号。
key_ string (可选) 类型为9 SVC_AGENT的发现检查的监控项键
value string (可选) 从服务接收的值,大多数服务可能为空。
status number (可选) 服务状态:

0, DOBJECT_STATUS_UP - 服务运行中
1, DOBJECT_STATUS_DOWN - 服务停止
autoregistration array (可选) 自动注册数据的arrayobjects。
clock number 自动注册数据时间戳。
主机 string 主机名。
ip string (可选) 主机IP地址。
dns string (可选) 从IP地址解析的DNS名称。
port string (可选) 主机端口。
主机_metadata string (可选) agent发送的主机元数据(基于HostMetadata或HostMetadataItem agent配置参数)。
tasks array (可选) 任务的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 Proxyversion(<主版本>.<次版本>.<构建号>)。
server→proxy:
response string 请求成功信息('success'或'失败')。
upload string 历史数据(历史记录、自动注册、主机可用性、网络发现)的上传控制。

可能的值:
enabled - 正常操作
disabled - 服务器不接受数据(可能由于内部缓存超过限制)
tasks array (可选) 任务的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的远程命令。
execute_on number 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) Port for Telnet and SSH commands.
authtype number (optional) Authentication type for SSH commands.
username string (optional) User name for Telnet and SSH commands.
password string (optional) Password for Telnet and SSH commands.
publickey string (optional) Public key for SSH commands.
privatekey string (optional) Private key for SSH commands.
parent_taskid number 父任务ID。
hostid number 目标主机 ID。

示例:

proxy→服务器:

{
           "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
       }

服务器→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
           }]
       }