A UPS in the map: read over NUT or SNMP, alerts, shutdown order

New UPS integration (NUT or SNMP v2c, read only). Monitoring -> UPS shows charge,
runtime, load and mains voltage with history and the times mains power was lost.
Mains lost and a nearly empty battery are critical alerts; battery to be replaced
and a heavy load are warnings. The UPS is a node in the dependency map and counts
as down while on battery, so servers that go offline with it are folded under its
alert; the page lists what is on it in the order to shut it down. /metrics series
and docs added.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-21 21:47:31 +02:00
1 parent 3cb3e4988f
commit 232a5661ab
38 files changed
+8049 -16

No files matched your search

+10
View File
@@ -99,6 +99,13 @@ export const INTEGRATION_FIELDS: Partial<Record<IntegrationType, IntegrationFiel
{ key: "token", label: "Long-lived access token", secret: true, type: "password", placeholder: "made on your profile page in Home Assistant" },
{ key: "insecure", label: "Allow self-signed certificate", secret: false, type: "checkbox" },
],
ups: [
{ key: "host", label: "Host name or address", secret: false, placeholder: "the machine running NUT (upsd), or the UPS's network card" },
{ key: "snmp", label: "Read it over SNMP (version 2c) instead of NUT", secret: false, type: "checkbox" },
{ key: "port", label: "Port", secret: false, optional: true, placeholder: "3493 for NUT, 161 for SNMP" },
{ key: "upsName", label: "NUT: the UPS's name", secret: false, optional: true, placeholder: "as in ups.conf; the first one listed when blank" },
{ key: "community", label: "SNMP: read community", secret: true, optional: true, type: "password", placeholder: "public when blank" },
],
osticket: [
{ key: "host", label: "Database host", secret: false, placeholder: "osticket-db.example.lan" },
{ key: "port", label: "Database port", secret: false, optional: true, placeholder: "3306" },
@@ -141,6 +148,9 @@ export function resolveBaseUrl(
): string {
const url = nonSecretFields.url;
if (typeof url === "string" && url) return url;
// A UPS has no web address; the host it is read from is what the card shows.
const host = nonSecretFields.host;
if (type === "ups" && typeof host === "string" && host) return host;
return INTEGRATION_BASE_URLS[type] ?? "";
}