Files
memory/systems/nut.md
T
2026-10-08 22:00:16 +00:00

48 lines
2.8 KiB
Markdown

---
title: NUT / UPS Shutdown-Kaskade
category: systems
tags: [nut, ups, apc, proxmox, shutdown, epic-9]
created: "2026-10-08"
modified: "2026-10-08"
---
# NUT / UPS Shutdown-Kaskade
## Überblick
APC Back-UPS ES 700G (USB 051d:0002, SN `5B1940T54935␣␣` — 2 Padding-Spaces, nie per serial matchen!) hängt an **ms-a2-1 (10.0.20.92)**. NUT-Master dort, alle übrigen 7 PVE-Nodes + NAS sind Netclient-Slaves. IaC: `iac-homelab/epic-9-ups-nut/ansible/` (Commits bis `beee480`).
## Topologie
- **Master ms-a2-1:** `nut-driver@apc` (usbhid-ups, vendorid/productid) → `upsd` 0.0.0.0:3493 → `nut-monitor` (upsmon MASTER) + `upssched`
- **Users:** `monuser` (upsmon master, für HA) + `slavemon` (upsmon slave, für Cluster-Clients) — PWs in 1P Vault „Hermes": Items „NUT upsd monuser (ms-a2-1)" + „NUT upsd slavemon (cluster)"
- **Slaves (7 PVE + NAS):** `MODE=netclient`, upsmon `slave` auf `apc@10.0.20.92`, FSD → `/sbin/shutdown -h now`, `nut-server` absent
## Shutdown-Kaskade (BY DESIGN)
1. Stromausfall → UPS meldet ONBATT → upssched startet 60s-Timer
2. Timer läuft ab (>60 s Dauerstörung) → `upsmon -c fsd` → FSD-Broadcast
3. Alle Slaves sehen FSD → sofortiger geordneter Shutdown (PVE fährt Gäste via Guest-Agent)
4. Master wartet `HOSTSYNC 45`s → fährt als letzter runter
- **LOWBATT → sofortiger FSD** (kein Warten auf Timer)
- Kurzunterbrechungen ≤60 s: Timer wird bei ONLINE gecancelt → kein Shutdown
## Betrieb & Verifikation
```bash
upsc apc@10.0.20.92 # Telemetrie (HA: sensor.apc_*)
systemctl is-active nut-monitor # auf ALLEN 9 Maschinen active
ansible-playbook -i inventory.ini site.yml # konvergentes Re-Deploy
# Rollback (Kaskade entschärfen): deploy-nut.yml (disarmiert bewusst)
```
## Grenzen / offene Risiken
- **Runtime 277 s @ 76 % Last** — knapp für Nodes mit vielen Gästen. Remediation: `qm set <vmid> --startup down=60`, zweite UPS (LB>SPOF).
- **n5pro:** pgdg-Repo deformiert (`dists/-pgdg`) — bricht apt-update; NUT-Deploy workaround über no-update_cache. Fix braucht GO.
- Single-UPS = Single Point of Failure für den ganzen Cluster (auch NAS mit ZFS-Pool).
- NAS `nut-driver.target not-found` = harmloses Phantom (Unit-Referenz ohne Paket).
## Monitoring
- **NUT-Watchdog** (Hermes-Cron `4cbf03ccb4de`, jede Minute, no_agent): `~/.hermes/scripts/check_ups_health.sh` fragt upsd via rohem NUT-Protokoll ab (`GET VAR apc ups.status` — anonym möglich, kein Secret). Quiet bei OL; Instant-Alert bei Statuswechsel (OB/LB/upsd down), 10-min-Reminder bei Dauerstörung, einmalige Recovery-Info. State: `~/.hermes/cache/nut_watchdog.state`.
## Related
- [[systems/homeassistant]] — NUT-Integration (Entry `5e1d2138…`, sensor.apc_*)
- [[reference/ip-map]]
- Bugfix-Doku: `docs/solutions/bug-fixes/2026-10-07-nut-ups-ms-a2-1-deployment.md`