Alert rules of your own, storage forecasts for Proxmox and Synology, and snooze

- Monitoring -> Alert rules: CPU, memory, disk use and disk temperature limits with a time, severity and scope (all, one server, a tag); try before saving; findings are ordinary health conditions
- Proxmox storages and Synology volumes are written down on each health pass (hourly, 400 days) and forecast like server disks: badge and history chart on the pages, alert, digest line, /metrics gauge
- Snooze an alert until a time; held back like maintenance, messages held, announced once again if still there when it ends
- Docs updated

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-20 23:38:36 +02:00
1 parent 788b3e073c
commit 24ae8db380
38 files changed
+7847 -8

No files matched your search

+63
View File
@@ -1472,6 +1472,56 @@ export interface AlertItem {
incidentId?: number | null;
/** Raised and cleared over and over: its raised/cleared messages are being held back. */
flapping?: boolean;
/** Snoozed until then: hidden like one under maintenance, and announced again if it is still there. */
snoozed?: { until: string; by: string };
}
export type AlertRuleMetric = "cpu" | "mem" | "disk" | "disk_temp";
export interface AlertRule {
id: number;
name: string;
enabled: boolean;
metric: AlertRuleMetric;
mount: string | null;
operator: "above" | "below";
threshold: number;
forMinutes: number;
severity: "warning" | "critical";
serverId: number | null;
serverName: string | null;
tag: string | null;
createdBy: string | null;
createdAt: string;
/** Where it is raised right now. */
firing: { serverId: number; serverName: string; detail: string | null; value: number; since: string | null }[];
}
export interface AlertRuleInput {
name: string;
enabled?: boolean;
metric: AlertRuleMetric;
mount?: string | null;
operator?: "above" | "below";
threshold: number;
forMinutes?: number;
severity?: "warning" | "critical";
serverId?: number | null;
tag?: string | null;
}
export interface StoragePool {
seriesId: number;
integrationId: number;
key: string;
label: string;
latest: number;
usedBytes: number | null;
totalBytes: number | null;
updatedAt: string;
trend: { perDay: number; daysToFull: number | null; fit: number; spanDays: number } | null;
/** Enough history and a straight enough climb to believe the trend. */
steady: boolean;
}
/** What a bulk action did: how many it changed, what it left alone and why, and the body that puts it back (to send to the same address). */
@@ -2402,6 +2452,17 @@ export const api = {
overview: () => request<NetworkOverview>("/api/network"),
sync: (integrationId?: number) => request<{ statuses: Record<number, UnifiSyncStatus> }>("/api/network/sync", { method: "POST", body: JSON.stringify(integrationId ? { integrationId } : {}) }),
},
alertRules: {
list: () => request<{ rules: AlertRule[]; servers: { id: number; name: string }[]; tags: string[] }>("/api/alert-rules"),
preview: (data: AlertRuleInput) => request<{ findings: { serverId: number; serverName: string; detail: string | null; value: number }[] }>("/api/alert-rules/preview", { method: "POST", body: JSON.stringify(data) }),
create: (data: AlertRuleInput) => request<{ rule: AlertRule }>("/api/alert-rules", { method: "POST", body: JSON.stringify(data) }),
update: (id: number, data: AlertRuleInput) => request<{ rule: AlertRule }>(`/api/alert-rules/${id}`, { method: "PUT", body: JSON.stringify(data) }),
remove: (id: number) => request<void>(`/api/alert-rules/${id}`, { method: "DELETE" }),
},
storage: {
overview: () => request<{ pools: StoragePool[]; forecastDays: number }>("/api/storage"),
history: (seriesId: number, days: number) => request<{ days: number; points: { t: string; v: number }[] }>(`/api/storage/${seriesId}/history?days=${days}`),
},
npm: {
overview: (refresh = false) => request<NpmOverview>(`/api/npm${refresh ? "?refresh=1" : ""}`),
},
@@ -2580,6 +2641,8 @@ export const api = {
assignees: () => request<{ users: { id: number; name: string; role: string }[] }>("/api/alerts/assignees"),
ack: (data: AckInput) => request<{ ack: AlertAck }>("/api/alerts/ack", { method: "PUT", body: JSON.stringify(data) }),
unack: (alertId: string) => request<void>(`/api/alerts/ack?alertId=${encodeURIComponent(alertId)}`, { method: "DELETE" }),
snooze: (alertId: string, until: string) => request<{ snooze: { until: string; snoozedBy: string } }>("/api/alerts/snooze", { method: "PUT", body: JSON.stringify({ alertId, until }) }),
unsnooze: (alertId: string) => request<void>(`/api/alerts/snooze?alertId=${encodeURIComponent(alertId)}`, { method: "DELETE" }),
noise: (days: number) => request<NoiseReport>(`/api/alerts/noise?days=${days}`),
},
incidents: {