monitor.sh: worker check accepts autoscaler (static worker retired)

Since the autoscaler takeover (static codex-cloud-worker stopped at
2026-10-26 07:02:55, disabled by design), the monitor's worker check
(systemctl is-active codex-cloud-worker) has failed every 5 minutes
while the real workers were healthy (health worker_ok kept passing,
GET /workers shows live autoscale-1 + host-1). A monitor that always
fails masks real failures. Fix: pass if either codex-autoscaler or
codex-cloud-worker is active, covering both deployment modes; the
health check still covers worker heartbeat freshness.
This commit is contained in:
host committed 2026-10-26 11:01:52 +08:00
1 parent 7c0e9366f8
commit c6754d0233
1 file changed
+6 -2
+6 -2
View File
@@ -7,7 +7,10 @@
#
# 检查项(全部不需要密码、不读 env 文件):
# server:systemctl is-active codex-cloud-server 为 active
# worker:systemctl is-active codex-cloud-worker 为 active
# worker:codex-autoscaler 或 codex-cloud-worker 任一为 active
# (autoscaler 接管后静态 worker 故意停用,只查静态会误报:
# 2026-10-26 07:02:55 静态 worker 停用后每 5 分钟 worker fail,
# 实际 worker 正常、health 的 worker_ok 也一直 pass)
# health:curl health,要求 ok=true、backend=postgres、db_ok=true、
# worker_ok=true(worker 心跳 180 秒内,见 server.py)
# postgres:pg_isready -h 127.0.0.1 -p 5432(只测就绪,不连库查数据,
@@ -43,7 +46,8 @@ check_server() {
}
check_worker() {
if systemctl is-active codex-cloud-worker >/dev/null 2>&1; then
if systemctl is-active codex-autoscaler >/dev/null 2>&1 \
|| systemctl is-active codex-cloud-worker >/dev/null 2>&1; then
echo pass
else
echo fail