homelab: Wächter und Geräteliste sehen volle Gastplatten (AdGuard stand bei 100 %)

Der Ausfuehrer schickt die Belegung der rootfs laufender Container mit; ab 85 % gelb, ab 95 % rot, in der
Geraeteliste als eigene Spalte und auf der Lampe des Geraets. Anlass: AdGuard (2 GB) war voll, das
Abfrageprotokoll schrieb nicht mehr und die Paketsuche scheiterte, ohne dass es eine Anzeige sagte.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hitonabi
2026-09-24 21:00:44 +02:00
co-authored by Claude Opus 5.5
parent eed36e9764
commit c08a144006
30 changed files with 146 additions and 32 deletions
+6
View File
@@ -53,6 +53,12 @@ describe("lampeFuer", () => {
expect(lampeFuer(arcane, false).label).toBe("Arcane")
})
it("warnt bei voller Platte vor allem anderen außer Stille", () => {
expect(lampeFuer({ ...netbird, platte: { belegt: 98, gesamt: 100 } }, true)).toMatchObject({ zustand: "fehler", wert: "Platte voll" })
expect(lampeFuer({ ...npm, platte: { belegt: 90, gesamt: 100 } }, false)).toMatchObject({ zustand: "warn", wert: "Platte 90 %" })
expect(lampeFuer({ ...npm, platte: { belegt: 50, gesamt: 100 } }, false).zustand).toBe("ok")
})
it("meldet ein stummes Gerät rot und ein laufendes Update als Info", () => {
expect(lampeFuer({ ...npm, erreichbar: false }, false).zustand).toBe("fehler")
expect(lampeFuer(npm, true)).toMatchObject({ zustand: "info", wert: "Update läuft" })
+14
View File
@@ -81,10 +81,24 @@ export function neuText(b: BausteinStand): string {
return b.kurz || b.verfuegbar || "neu"
}
/** Anteil der belegten Platte (0…1) oder null, wo unbekannt. Ab 85 % gelb, ab 95 % rot — wie der Wächter. */
export function plattenAnteil(ziel: ZielStand): number | null {
const p = ziel.platte
return p && p.gesamt > 0 ? p.belegt / p.gesamt : null
}
export const PLATTE_GELB = 0.85
export const PLATTE_ROT = 0.95
export function lampeFuer(ziel: ZielStand, laeuft: boolean): Lampe {
const label = kurzname(ziel)
const platte = plattenAnteil(ziel)
if (ziel.erreichbar === false) return { id: ziel.id, label, zustand: "fehler", wert: "antwortet nicht" }
if (platte !== null && platte >= PLATTE_ROT) return { id: ziel.id, label, zustand: "fehler", wert: "Platte voll" }
if (laeuft) return { id: ziel.id, label, zustand: "info", wert: "Update läuft" }
if (platte !== null && platte >= PLATTE_GELB) {
return { id: ziel.id, label, zustand: "warn", wert: `Platte ${Math.round(platte * 100)} %` }
}
const neu = ziel.bausteine.filter((b) => b.zustand === "neu")
if (neu.length > 0) {
const b = neu.find((x) => APP.has(x.id)) ?? neu[0]
+2
View File
@@ -280,6 +280,8 @@ export interface ZielStand {
rueckweg: string | null
/** Kurzform des Rückwegs; ältere Stände liefern nur den Text. */
rueckweg_art?: "snapshot" | "sicherung" | "keiner" | null
/** Belegung der Platte in Bytes, wo bekannt (laufende Container). */
platte?: { belegt: number; gesamt: number } | null
zaehlung: Partial<Record<BausteinZustand, number>>
offen: number
}