1.3 KiB
1.3 KiB
监测插槽显示 CPU 核数 / 内存 / 硬盘容量
日期:2026-06-13
变更摘要
实时监测插槽展示完整硬件与用量细节:CPU 型号与物理/逻辑核、内存/磁盘已用与剩余、交换分区、系统版本与运行时长;负载显示 1/5/15 分钟。
动机
用户需要在插槽卡片上直观看到子机配置与实时占用,而不只有总量与使用率百分比。
涉及文件
server/utils/watch_metrics.py— 扩展探针字段、fill_hardware_gapsserver/infrastructure/ssh/remote_probe.py— SSH 探针采集详情server/background/watch_probe_runner.py— 探针后补齐用量web/agent/agent.py—_hardware_specs_dict()心跳上报frontend/src/components/watch/WatchSlotCard.vue、WatchMetricBar.vuefrontend/src/utils/watchFormat.ts、useWatchPins.tstests/test_watch_metrics.py
迁移 / 重启
无 DB 变更。SSH 监测即时生效;Agent 需升级后 Redis 通道才有完整字段(旧数据可用百分比推算已用/剩余)。
验证方式
.venv/bin/pytest tests/test_watch_metrics.py -q
cd frontend && npx vite build
浏览器:监测槽应显示系统横幅、CPU 型号、已用/总量、可用/剩余、Swap(若有)、负载 1/5/15。