0.1.5: card UPS; backup con marcatore robusto ai riavvii

This commit is contained in:
Carlo Baratto committed 2026-10-31 13:38:40 +01:00
1 parent 29a63a74d4
commit 8ed183c1fc
6 files changed
+186 -18

No files matched your search

+35 -1
View File
@@ -18,6 +18,34 @@ Copia il collector in `~/.local/share/statod/`, genera il token in
`~/.config/statusd/token` (0600) e attiva le due unit utente. La sopravvivenza
al logout richiede `loginctl enable-linger <utente>`.
## Marcatore dell'ultimo backup (una volta, richiede root)
I timestamp delle unit systemd si **azzerano a ogni riavvio**, `/var/log/borg`
è `borg:borg 750` e il journal non è leggibile senza i gruppi `adm` o
`systemd-journal`: senza un marcatore, dopo un reboot l'età del backup è
semplicemente ignota. Il drop-in crea `/var/lib/borg-last-run` (leggibile da
tutti) al termine di ogni giro:
```sh
sudo mkdir -p /etc/systemd/system/borg.service.d
sudo tee /etc/systemd/system/borg.service.d/10-lastrun.conf >/dev/null <<'EOF'
[Service]
ExecStartPost=/bin/sh -c 'date -Is > /var/lib/borg-last-run'
EOF
sudo systemctl daemon-reload
```
Finché il marcatore non esiste, `backups.age_hours` resta `null` e l'app mostra
"—" con la nota "ora del giro non registrata": è voluto, meglio di un numero
inventato.
## UPS (NUT)
Lo stato arriva da `upsc -l` + `upsc <nome>`: nessuna configurazione da fare
nell'app finché NUT è attivo (`nut-server`, `nut-monitor`). Se `upsc -l` non
elenca dispositivi, la sezione `ups` è `null` e la card mostra "nessun UPS
rilevato".
## Esposizione
`statusd-http.service` ascolta su `0.0.0.0:8792`. Il firewall YunoHost ha
@@ -57,7 +85,13 @@ Nessun log HTTP: il token non finisce su disco. Il server non ha altre rotte.
"containers": { "running": [ { "name": "…", "status": "Up 2 days", "ok": true } ],
"available": true },
"backups": { "name": "borg", "last_run": "…", "result": "success",
"exit_code": 0, "age_hours": 41.5 },
"exit_code": 0, "age_hours": 41.5,
"source": "marker" },
"ups": { "name": "ups", "available": true, "status": "OL",
"charge_pct": 100.0, "runtime_s": 3000.0, "load_pct": 2.0,
"input_voltage": 246.5, "battery_voltage": 13.4,
"input_frequency": 50.1, "beeper": "enabled",
"driver": "nutdrv_qx" },
"services": { "failed": [ { "unit": "…", "description": "…" } ] },
"access": { "ssh_failed_24h": 0 },
"updates": { "total": 0, "security": 0, "packages": [],