Files
Nexus/docs/changelog/2026-06-12-watch-install-psutil-ssh.md
T
Nexus Agent 75efd506f5 feat(watch): 监测槽 SSH 一键安装 psutil
探针报 psutil missing 时显示安装按钮;POST install-psutil 经 SSH pip/apt 安装并审计。
2026-06-12 04:04:48 +08:00

1.3 KiB
Raw Blame History

Changelog — 监测槽一键 SSH 安装 psutil

日期2026-06-12

摘要

监测槽探针报「子机未安装 psutil」时,卡片内显示 「安装 psutilSSH)」 按钮,通过 SSH 在子机系统 Python 安装 psutilpip --user → apt/yum → pip)。

动机

SSH 监测探针依赖系统 python3 的 psutilAgent 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.py
  • server/api/watch.py
  • frontend/src/components/watch/WatchSlotCard.vue
  • frontend/src/components/watch/WatchSlotRow.vue
  • frontend/src/utils/watchFormat.ts
  • tests/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