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:
1 parent
3cb3e4988f
commit
232a5661ab
38 files changed
+8049
-16
No files matched your search
+44
-1
@@ -1430,6 +1430,45 @@ export interface HaWatchedEntity {
|
||||
entity: { friendlyName: string | null; state: string; value: number | null; unit: string | null; deviceClass: string | null; lastChanged: string | null; unavailableSince: string | null; updatedAt: string } | null;
|
||||
}
|
||||
|
||||
/** One UPS: how it is now, what is wrong, and what is on it in the order to shut it down. */
|
||||
export interface UpsInfo {
|
||||
id: number;
|
||||
name: string;
|
||||
enabled: boolean;
|
||||
protocol: "nut" | "snmp";
|
||||
/** How the last read went; `at` is the last one that worked. */
|
||||
status: { at: string; ok: boolean; error: string | null } | null;
|
||||
/** The last good read is recent enough to be believed. */
|
||||
fresh: boolean;
|
||||
state: {
|
||||
model: string | null;
|
||||
manufacturer: string | null;
|
||||
statusText: string;
|
||||
onBattery: boolean;
|
||||
lowBattery: boolean;
|
||||
replaceBattery: boolean;
|
||||
overload: boolean;
|
||||
charge: number | null;
|
||||
runtimeSeconds: number | null;
|
||||
loadPercent: number | null;
|
||||
inputVoltage: number | null;
|
||||
outputVoltage: number | null;
|
||||
onBatterySince: string | null;
|
||||
updatedAt: string;
|
||||
} | null;
|
||||
problems: { key: string; kind: "battery" | "low" | "replace" | "load"; severity: "critical" | "warning"; message: string }[];
|
||||
/** Everything that needs this UPS, directly or through something else; step 1 is shut down first. */
|
||||
carries: { key: string; type: "server" | "integration" | "device"; id: number; name: string; step: number }[];
|
||||
orderLooped: boolean;
|
||||
}
|
||||
|
||||
export interface UpsHistory {
|
||||
ups: { id: number; name: string };
|
||||
days: number;
|
||||
points: { t: string; charge: number | null; runtimeSeconds: number | null; loadPercent: number | null; inputVoltage: number | null; onBattery: boolean }[];
|
||||
onBatteryPeriods: { from: string; to: string; ongoing: boolean }[];
|
||||
}
|
||||
|
||||
export interface HaOverview {
|
||||
integrations: { id: number; name: string; enabled: boolean; status: HaSyncStatus | null; fresh: boolean; watched: HaWatchedEntity[]; problems: IntegrationProblem[] }[];
|
||||
}
|
||||
@@ -1933,7 +1972,7 @@ export interface ManualTaskInput {
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type IntegrationType = "proxmox" | "synology" | "semaphore" | "tailscale" | "gitea" | "dockhand" | "uptimekuma" | "phpipam" | "pbs" | "osticket" | "unifi" | "npm" | "homeassistant";
|
||||
export type IntegrationType = "proxmox" | "synology" | "semaphore" | "tailscale" | "gitea" | "dockhand" | "uptimekuma" | "phpipam" | "pbs" | "osticket" | "unifi" | "npm" | "homeassistant" | "ups";
|
||||
|
||||
export interface IntegrationField {
|
||||
key: string;
|
||||
@@ -2453,6 +2492,10 @@ export const api = {
|
||||
create: (label: string) => request<{ token: MetricsToken; secret: string }>("/api/metrics-tokens", { method: "POST", body: JSON.stringify({ label }) }),
|
||||
remove: (id: number) => request<void>(`/api/metrics-tokens/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
ups: {
|
||||
list: () => request<{ ups: UpsInfo[] }>("/api/ups"),
|
||||
history: (id: number, days: number) => request<UpsHistory>(`/api/ups/${id}/history?days=${days}`),
|
||||
},
|
||||
eventWebhooks: {
|
||||
list: () => request<{ webhooks: EventWebhook[]; events: WebhookEventName[] }>("/api/event-webhooks"),
|
||||
create: (data: { label: string; url: string; secret?: string; events: WebhookEventName[] }) => request<{ webhook: EventWebhook }>("/api/event-webhooks", { method: "POST", body: JSON.stringify(data) }),
|
||||
|
||||
Reference in new issue
Block a user