Proxy 负载均衡 允许通过 proxy 组 对 主机 进行监控,并在 proxies 之间自动分发 主机,同时提供高可用性 proxy。
如果一个 proxy 从 proxy 组 中下线,则其 主机 将立即分配给组内分配最少 主机 的其他 proxies。或者,如果某个 proxy 的 主机 数量与组平均值相比过多/过少,则会通过均匀分配 主机 来触发组的重新平衡。
主机 重分配仅发生在联机 proxy 组 中。如果某个 proxy 组 的配置最小数量的 proxies 处于联机状态(非离线或未知状态),则该节点视为“联机”。
:::notetip 组中在线proxies的最小数量应小于该组的proxy总数。在包含10个proxies的组中,将最小在线proxy数量设置为10,会导致只要有一个proxy发生故障,整个组都会下线的情况。建议要求至少有6个在线的proxies,这样可以支持4个非健康的proxies。 仅返回OutputFormat格式要求结果
proxy 状态为:
您可以使用 zabbix[proxy 组,<name>,state] 和 zabbix[proxy 组,discovery] 内部 监控项 来监控 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: