6859846b7c
- bootstrap 失败恢复 SSH 临时登录回退 - ssh_bootstrap 真安装检测与 config 目录自愈 - axs Gitea 发布源切换为 https://axs.kuma1xn.vip
1.2 KiB
1.2 KiB
Agent 2.1.1:监测模式 CPU 采样优化
日期:2026-07-02
变更摘要
修复四槽实时监测下 CPU 曲线长期显示 0% 的问题:
- 新增
web/agent/cpu_metrics.py:监测模式用interval=None测约 5s 窗口(与心跳间隔对齐);首次进入 watch 用 1s bootstrap agent.py升至 v2.1.1,_build_system_info改用sample_watch_cpu_bundle(含per_cpu_pct)- 升级/安装脚本同步下载
cpu_metrics.py
动机
v2.1.0 监测模式用 psutil.cpu_percent(interval=0.3),低负载机器常四舍五入为 0;内存/负载正常,属采样窗口过短而非探针故障。
涉及文件
web/agent/cpu_metrics.py(新建)web/agent/agent.py— v2.1.1server/application/server_batch_common.py— curl 下载 cpu_metricstests/test_agent_cpu_metrics.py(新建)
迁移
- 中心:部署后
/agent/cpu_metrics.py可访问 - 子机:Pin 且开实时监测的机器点槽内「升级 Agent」至 2.1.1
验证
.venv/bin/pytest tests/test_agent_cpu_metrics.py tests/test_agent_watch_mode.py -q
升级后探针 cpu_pct 在低负载下应出现非零小幅波动,不再长期贴 0。