本节提供以下信息:
Agent2 -> 服务器 : 主动检查请求
服务器 -> Agent2 : 主动检查响应
Agent2 -> 服务器 : agent 数据请求
服务器 -> Agent2 : agent 数据响应
主动检查请求用于获取由agent处理的主动检查项。该请求由agent在启动时发送,随后按RefreshActiveChecks间隔定期发送。
| 字段 | 类型 | 必填 | 值 |
|---|---|---|---|
| request | string | yes | active checks |
| host | string | yes | 主机名. |
| version | string | yes | agent的version版本: <主版本>.<次版本>. |
| host_metadata | string | no | 配置参数HostMetadata或HostMetadataItem的指标值。 |
| interface | string | no | 配置参数HostInterface或HostInterfaceItem的指标值。 |
| ip | string | no | 若设置则返回配置参数ListenIP的第一个IP地址。 |
| port | number | no | 若设置且非默认agent监听端口,则返回配置参数ListenPort的值。 |
示例:
{
"request": "active checks",
"host": "Zabbix server",
"version": "6.0",
"host_metadata": "mysql,nginx",
"hostinterface": "zabbix.server.lan",
"ip": "159.168.1.1",
"port": 12050
}主动检查响应由服务器在处理完主动检查请求后发送回agent.
| 字段 | 类型 | 必填 | 值 | |
|---|---|---|---|---|
| response | string | yes | success \ |
|
| info | string | no | 失败时的错误信息. | |
| data | array of objects | no | 主动检查监控项. | |
| key | string | no | 带扩展宏的监控项键值. | |
| itemid | number | no | 监控项标识符. | |
| delay | string | no | 监控项update间隔. | |
| lastlogsize | number | no | 监控项lastlogsize. | |
| mtime | number | no | 监控项mtime. | |
| regexp | array of objects | no | 全局正则表达式. | |
| name | string | no | 全局正则表达式名称. | |
| expression | string | no | 全局正则表达式. | |
| expression_type | number | no | 全局正则表达式类型. | |
| exp_delimiter | string | no | 全局正则表达式分隔符. | |
| case_sensitive | number | no | 全局正则表达式大小写敏感设置. | |
示例:
{
"response": "success",
"data": [
{
"key": "log[/home/zabbix/logs/zabbix_agentd.log]",
"itemid": 1234,
"delay": "30s",
"lastlogsize": 0,
"mtime": 0
},
{
"key": "agent.version",
"itemid": 5678,
"delay": "10m",
"lastlogsize": 0,
"mtime": 0
}
]
}agent数据请求包含收集的监控项值.
| 字段 | 类型 | 必填 | 值 | |
|---|---|---|---|---|
| request | string | yes | agent data |
|
| host | string | yes | 主机名. | |
| version | string | yes | agentversion: <major>.<minor>. | |
| session | string | yes | 每次启动agent时生成的唯一会话标识符. | |
| data | array of objects | yes | 监控项值. | |
| id | number | yes | 值标识符(用于在网络问题情况下检查重复值的递增计数器). | |
| itemid | number | yes | 监控项标识符. | |
| value | string | no | 监控项值. | |
| lastlogsize | number | no | 监控项lastlogsize. | |
| mtime | number | no | 监控项mtime. | |
| state | number | no | 监控项状态. | |
| source | string | no | 值事件日志来源. | |
| eventid | number | no | 值事件日志eventid. | |
| severity | number | no | 值事件日志严重级别. | |
| timestamp | number | no | 值事件日志时间戳. | |
| clock | number | yes | 值时间戳(自Epoch起的秒数). | |
| ns | number | yes | 值时间戳纳秒部分. | |
示例:
{
"request": "agent data",
"data": [
{
"id": 1,
"itemid": 5678,
"value": "2.4.0",
"clock": 1400675595,
"ns": 76808644
},
{
"id": 2,
"itemid": 1234,
"lastlogsize": 112,
"value": " 19845:20140621:141708.521 Starting Zabbix Agent [<hostname>]. Zabbix 2.4.0 (revision 50000).",
"clock": 1400675595,
"ns": 77053975
}
],
"host": "Zabbix server",
"version": "6.0",
"session": "1234456akdsjhfoui"
}服务器在处理完agent数据请求后,会将agent数据响应发送回agent。
| 字段 | 类型 | 必填 | 值 |
|---|---|---|---|
| response | string | yes | success \ |
| info | string | yes | 监控项处理结果。 |
示例: