d8d1e17758
Add agentapi HostMetrics() + a thin /api/host-metrics proxy to the agent's new GET /host/metrics, and a 'Szerver allapota (gazdagep)' card on the monitoring page rendering host CPU%/load/mem/CPU-temp(n/a)/uptime + per- storage capacity bars (thin-pool fill, disk temp/wear). Polls every 8s. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.3 KiB
2.3 KiB
REPORT — slice 9 (controller half): host-health view (v0.39.0) (2026-06-10)
Overwrite-latest report. Cumulative history: CHANGELOG.md.
What was implemented
The customer-facing half of slice 9. Pairs with felhom-agent v0.14.0. The de-privileged
controller (slice 8C) sees only its own cgroup, so it can't read the host. The monitoring page now
shows the real Proxmox box, proxied from the agent's new GET /host/metrics.
internal/agentapi — client method
Client.HostMetrics(ctx)— calls the agent'sGET /host/metricsover the leaf-pinned, per-guest-token channel (same client as the 8C disk proxy). New mirror structsHostMetrics(with nullableCPUTempC),StorageTarget,ThinPoolFill,SmartSummary(a subset — only the fields the UI renders; unknown wire keys ignored).
internal/web — proxy + UI
ServeHostMetricsAPI(agent_host_metrics_handler.go) — a thin read-only proxy:GET /api/host-metrics→ agentGET /host/metrics. Returns the{ok,data,error}envelope; 503 when the local API is not configured (unprovisioned guest), 502 on an agent error. Wired inmain.gobehindRequireAuth(GET-only → no CSRF wrapper).- Monitoring view (
templates/monitoring.html): a new "Szerver állapota (gazdagép)" card at the top renders the host block (CPU% + load, memory used/total, CPU temp or "n/a" when null, uptime) + per-storage capacity bars (used/total, thin-pool fill, disk temp/wear), reusing the existingsystem-bar/storage-itemstyling. Polls/api/host-metricsevery 8 s while the page is open (a live snapshot, distinct from the controller's own 60 s charts); yellow "nem elérhető" banner when the agent is unreachable.
Tests (green)
agentapi/host_metrics_test.go: decodes host + storage (thin-pool, SMART temp + NVMe wear), USB drive's null SMART, and a nullcpu_temp_c→ nil pointer.go build ./...+go test ./internal/agentapi ./internal/webgreen.
Versioning / docs
- Version
0.38.0 → 0.39.0(set at build via ldflags);CHANGELOG.md+controller/README.md(Monitoring → "Host (Proxmox box) Health" section) updated.
Pending
- Build + deploy controller v0.39.0 to the demo nodes and live-validate the monitoring page
against the real N100 (cross-check vs
pvesh/free/df).