Proxy 负载均衡 支持通过 proxy 组 监控 主机,并能在 proxies 之间自动分配 主机,同时保障高 proxy 可用性。
如果proxy 组中的某个proxy离线,其主机将立即分配给组内当前分配主机最少的其他proxies。或者,当某个proxy的主机数量显著高于/低于组内平均值时,将触发通过均匀分配主机实现的组内再平衡机制。
主机重新分配仅发生在在线proxy 组中。当配置的最小数量proxies处于在线状态(非离线或未知状态)时,proxy 组即被视为"在线"。
在线proxies的最小数量应少于组内proxy总数。在包含10个proxies的群组中,将最小在线proxy数设置为10会导致当仅有一个proxy故障时整个群组将脱机。建议要求6个在线proxies,这样可支持4个不健康的proxies。
proxy 状态为:
您可以通过zabbix[proxy 组,<名称>,状态]和zabbix[proxy 组,发现]内部监控项来监控proxy 组状态。
Proxy 负载均衡和高可用性由服务器进程类型与线程进程管理。proxy 组管理器始终知晓其他proxies的健康或异常状态。
版本兼容性
Proxy load balancing and high availability is managed by Zabbix server via the proxy group manager, which continuously monitors the state of all proxies in each proxy group and their host distribution.
Proxy high availability within a group is triggered when a proxy goes offline—its hosts are immediately redistributed to other proxies. Proxy load balancing also occurs, as hosts are reassigned to proxies with the fewest assigned hosts.
Additionally, proxy load balancing is triggered when proxy host count differs from the group average by at least 10 hosts and a factor of 2 (host excess or host deficit). If the imbalance persists after a grace period (10 x failover delay), the proxy group is queued for host redistribution.
The proxy group manager redistributes hosts using the following logic:
Examples of host redistribution:
Hosts on proxy | Group average | Host reassignment |
---|---|---|
100 | 50 | Yes |
60 | 50 | No |
40 | 50 | No |
25 | 50 | Yes |
15 | 5 | Yes |
10 | 5 | No |
Hosts monitored by a single proxy (even if it belongs to a proxy group) are not involved in load balancing/high availability. Additionally, having fewer than 10 hosts monitored by a proxy group may lead to uneven host distribution among proxies in the group.
要在 Zabbix 前端配置一个 proxy 组:
参数 | 描述 |
---|---|
Name | 输入 proxy 组 名称。 |
Failover period | 输入故障转移执行前的等待时间(默认为 1m;允许范围为 10s-15m)。 支持时间后缀(例如,30s,1m)。 支持用户宏。 |
Minimum number of proxies | 输入组在线所需的最少在线 proxies 数量(默认为 1;允许范围为 1-1000)。 支持用户宏。 |
Description | 输入 proxy 组 描述。 |
Proxies | 组中的 proxies 列表。最多显示五个 proxies(根据对 proxy 的权限,显示为链接或纯文本)。 当编辑现有 proxy 组 且组中至少有一个 proxy 时,将显示此列表。 |
配置 Proxy 负载均衡 以监控 主机:
1。创建一个 proxy 组(参见下面的“配置 proxy 组”)。
对于被动检查,组的所有 proxies 必须列在 agents 的 Server 参数中。
将组的所有 proxies 添加到被监控 主机 的 serveractive agent 参数中(以分号分隔)是有益的,但不是强制性的。
一个主动的 agent 可以在 ServerActive 字段中只有一个 proxy,Proxy 负载均衡 仍可正常工作。
当 agent 服务启动时,agent 将接收所有 Zabbix proxies 的完整 IP 地址列表,并加载到内存中并保持。
主动检查(和 Zabbix 发送器数据请求)将根据当前 proxy-主机 分配情况,被重定向到正确的在线 proxy 进行 主机。
如果在 ServerActive 字段中只有一个 proxy,当该特定 proxy 离线时重启 agent 可能导致监控数据丢失。
2。确保 proxy 组 处于在线状态。
3。配置这些 主机 由 proxy 组 监控(而不是单个的 proxies)。您可以使用 主机 mass update 将 主机 从 proxy 移动到 proxy 组。
由单个 proxy 监控的 主机(即使它属于某个 proxy 组)不参与负载均衡/高可用性。
此外,分配给某个 proxy 组 的 主机 少于 10 个,可能导致组内 proxies 之间的 主机 分布不均。
4。等待几秒钟以完成配置 update 以及 proxy 组 内 proxies 之间的 主机 分布。通过刷新 Monitoring -> 主机 中的 主机 列表来观察变化。
当 一个主机 是基于来自属于 proxy 组 的某个 proxy 的自动注册/网络发现数据创建时——则该 主机 将被设置为由该 proxy 组 监控。
To test proxy load balancing: