Zabbix 统计信息的远程监控
概述
可以将 Zabbix 服务器和 proxy 的某些内部指标远程提供给其他 Zabbix 实例或第三方工具访问。 这样,支持人员或服务提供商便可以远程监控其客户的 Zabbix 服务器或 proxy;或者,在 Zabbix 不是主要监控工具的组织中,第三方系统可以在统一监控架构中监控 Zabbix 的内部指标。
Zabbix 内部统计信息会提供给新 StatsAllowedIP 服务器/proxy 参数中列出的可配置地址集。
仅接受来自这些地址的请求。
监控项
要配置对另一个 Zabbix 实例的内部统计信息查询,可以使用以下两种监控项:
zabbix[stats,<ip>,<port>]内部监控项 - 用于直接远程查询 Zabbix 服务器/proxy。使用 <ip> 和 <port> 标识目标实例。zabbix.stats[<ip>,<port>]agent 监控项 - 用于基于 agent 远程查询 Zabbix 服务器/proxy。使用 <ip> 和 <port> 标识目标实例。
另请参阅:内部监控项、Zabbix agent 监控项。
下图根据上下文说明了两种监控项的使用方式。

- 服务器 → 外部 Zabbix 实例(zabbix[stats,<ip>,<port>])
- 服务器 → proxy → 外部 Zabbix 实例(zabbix[stats,<ip>,<port>])
- 服务器 → agent → 外部 Zabbix 实例(zabbix.stats[<ip>,<port>])
- 服务器 → proxy → agent → 外部 Zabbix 实例(zabbix.stats[<ip>,<port>])
要确保目标实例允许外部实例查询其信息,请在目标实例的 StatsAllowedIP 参数中列出外部实例的地址。
暴露的指标
stats 监控项批量收集统计信息并返回 JSON,这是依赖监控项获取其数据的基础。 以下内部监控项由这两个监控项中的任意一个返回:
zabbix[boottime]zabbix[hosts]zabbix[items]zabbix[items_unsupported]zabbix[preprocessing](仅服务器)zabbix[preprocessing_queue](仅服务器)zabbix[process,<type>,<mode>,<state>](仅基于进程类型的统计信息)zabbix[rcache,<cache>,<mode>]zabbix[requiredperformance]zabbix[triggers](仅服务器)zabbix[uptime]zabbix[vcache,buffer,<mode>](仅服务器)zabbix[vcache,cache,<parameter>]zabbix[version]zabbix[vmware,buffer,<mode>]zabbix[wcache,<cache>,<mode>](仅服务器支持“trends”缓存类型)
模板
以下模板可用于从外部实例远程监控 Zabbix 服务器或 proxy 的内部指标:
请注意,要使用模板远程监控多个外部实例,必须为每个外部实例的监控分别创建一个主机。
Trapper 进程
从外部 Zabbix 实例接收内部指标请求由 trapper 进程处理。该进程会验证请求、收集指标、创建 JSON 数据缓冲区,并将准备好的 JSON 返回,例如从服务器返回:
{
"response": "success",
"data": {
"boottime": N,
"uptime": N,
"hosts": N,
"items": N,
"items_unsupported": N,
"preprocessing": {
"queued": {
"count": N,
"size": N
},
"direct": {
"count": N,
"size": N
},
"queue": N
},
"preprocessing_queue": N,
"process": {
"alert manager": {
"busy": {
"avg": N,
"max": N,
"min": N
},
"idle": {
"avg": N,
"max": N,
"min": N
},
"count": N
},
...
},
"queue": N,
"rcache": {
"total": N,
"free": N,
"pfree": N,
"used": N,
"pused": N
},
"requiredperformance": N,
"triggers": N,
"uptime": N,
"vcache": {
"buffer": {
"total": N,
"free": N,
"pfree": N,
"used": N,
"pused": N
},
"cache": {
"requests": N,
"hits": N,
"misses": N,
"mode": N
}
},
"vmware": {
"total": N,
"free": N,
"pfree": N,
"used": N,
"pused": N
},
"version": "N",
"wcache": {
"values": {
"all": N,
"float": N,
"uint": N,
"str": N,
"log": N,
"text": N,
"not supported": N
},
"history": {
"pfree": N,
"free": N,
"total": N,
"used": N,
"pused": N
},
"index": {
"pfree": N,
"free": N,
"total": N,
"used": N,
"pused": N
},
"trend": {
"pfree": N,
"free": N,
"total": N,
"used": N,
"pused": N
}
}
}
}
内部队列监控项
还有另外两个监控项,专门用于远程查询另一个 Zabbix 实例上的内部队列统计信息:
zabbix[stats,<ip>,<port>,queue,<from>,<to>]内部监控项 - 用于直接查询远程 Zabbix 服务器/proxy 的内部队列zabbix.stats[<ip>,<port>,queue,<from>,<to>]agent 监控项 - 用于通过 agent 查询远程 Zabbix 服务器/proxy 的内部队列
另请参阅:内部监控项、Zabbix agent 监控项。