75efd506f5
探针报 psutil missing 时显示安装按钮;POST install-psutil 经 SSH pip/apt 安装并审计。
1.3 KiB
1.3 KiB
Changelog — 监测槽一键 SSH 安装 psutil
日期:2026-06-12
摘要
监测槽探针报「子机未安装 psutil」时,卡片内显示 「安装 psutil(SSH)」 按钮,通过 SSH 在子机系统 Python 安装 psutil(pip --user → apt/yum → pip)。
动机
SSH 监测探针依赖系统 python3 的 psutil;Agent venv 内的 psutil 无法被探针脚本使用。手动 SSH 安装成本高。
变更
- 后端:
POST /api/watch/servers/{server_id}/install-psutil(须已 Pin 该服务器) server/utils/psutil_install.py:远程安装脚本 + 验证- 前端:
WatchSlotCard在 psutil 错误时显示按钮;WatchSlotRow调用 API 并 refresh - 审计:
watch_install_psutil
涉及文件
server/utils/psutil_install.py(新)server/application/services/watch_service.pyserver/api/watch.pyfrontend/src/components/watch/WatchSlotCard.vuefrontend/src/components/watch/WatchSlotRow.vuefrontend/src/utils/watchFormat.tstests/test_psutil_install.py(新)tests/test_watch_pins.py
迁移 / 重启
- 无需迁移;需重启 API + 前端构建
验证
.venv/bin/pytest tests/test_psutil_install.py tests/test_watch_pins.py -q
cd frontend && npm run type-check