实现应用健康监控(07-27-app-health-monitoring)

这个提交包含在:
2026-07-27 22:30:33 +08:00
父节点 99a6c20981
当前提交 bb5113c58b
共修改 15 个文件,包含 1111 行新增和 0 行删除
+31
查看文件
@@ -340,6 +340,37 @@ RESTORE_SCOPE=shadow \
- 确认完整批次已经复制到异机/异盘,而不是仍只保存在应用主机。
- 准备独立 smoke 账号,避免使用老板、管理员或真实员工账号跑自动化。
## 1.6 ARM 公网应用健康监控(启用仍为 EXTERNAL_GATED)
应用健康监控与自动备份 dead-man 共用受控企微群机器人入口,但使用独立探测器、systemd units、probe state 和 alert state。它从 ARM 每 5 分钟访问公网 HTTPS `/ready`;连续两次失败才告警,一次成功即恢复。不得把它并入备份 receiver 的安装/卸载生命周期,也不得以本地测试通过代替 ARM 已启用证据。
先在仓库运行无真实消息合同:
```bash
bash scripts/qa/run-app-health-monitor-contract.sh
```
获得 ARM systemd 写入批准后,使用受控配置中的绝对路径安装 disabled units。命令中的 webhook 正文不得作为参数、环境变量或聊天内容出现:
```bash
PROBE_SOURCE=<repo-app-health-probe> \
ALERT_WEBHOOK_FILE=<controlled-root-only-webhook-file> \
ALERT_HELPER_SOURCE=<repo-group-alert-helper> \
ALERT_HELPER_TARGET=<installed-shared-alert-helper> \
bash deploy/trialrun/install-offhost-app-health-monitor.sh install
```
安装后先人工执行一次 oneshot 并核对只含稳定状态/类别的输出;另获真实消息与 timer 启用批准后再执行同参数的 `enable`。检查 enabled/active、最近结果和下一次运行:
```bash
systemctl is-enabled hyb-oa-public-app-health.timer
systemctl is-active hyb-oa-public-app-health.timer
systemctl list-timers hyb-oa-public-app-health.timer --no-pager
systemctl status hyb-oa-public-app-health.service --no-pager
```
真实验收需受控制造持续失败,确认首次失败不发、第二次失败只发一条、相同失败降噪、恢复只通知一次。只测试机器人能发送不算健康监控通过。卸载前先记录脱敏状态,随后执行安装器 `uninstall`;该操作只删除应用健康 units 和探测器,保留状态、共用 helper、webhook、备份 receiver、dead-man 和归档。
## 2. 升级流程(试运行)
建议版本化方式:
- 每次发布打 tag,例如 `trialrun-2026-02-08-01`