Fold alerts under their host, recurring maintenance, run playbooks from alerts, and an Updates page

- Servers can say what they run on (or it is worked out from the Proxmox node); when the host is
  down the guests' offline alerts fold under it: held back, not counted, not notified, still recorded.
- Recurring maintenance schedules made into ordinary windows a week ahead (maintenance_schedules).
- Run a Semaphore template limited to a server from its page or an alert, and watch the run.
- Agents report pending updates (apt, dnf, zypper, Windows Update); an Updates page lists them.
- Migrations 0024 and 0025.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-17 01:35:15 +02:00
1 parent 44e393f172
commit 171511c6db
45 files changed
+6772 -44

No files matched your search

+78 -3
View File
@@ -490,6 +490,38 @@ export interface ServerRecord {
proxmoxVmid: number | null;
hideProxmoxLink: boolean;
tags: string[];
/** The server this one runs on, when an admin said so; null means it is worked out from the Proxmox node. */
parentServerId: number | null;
/** What the agent says is waiting to be installed; null until it has said. */
pendingUpdates: PendingUpdates | null;
/** When updates were first seen waiting (and none were before); null when none are. */
updatesPendingSince: string | null;
}
export interface PendingUpdates {
manager: string;
count: number;
/** Null when the package manager can't say which are security fixes. */
security: number | null;
rebootRequired: boolean;
reportedAt: string;
}
/** One server on the Updates page. */
export interface UpdatesServer {
id: number;
name: string;
osType: string;
lastSeenAt: string | null;
updates: PendingUpdates | null;
pendingSince: string | null;
}
/** What a server runs on, and what runs on it. `auto`: worked out from the Proxmox node rather than set by hand. */
export interface ServerRelation {
id: number;
name: string;
auto: boolean;
}
export interface ServerHardware {
@@ -531,6 +563,7 @@ export interface ServerDetail {
hardware: ServerHardware;
dnsMatches: DnsMatch[];
links: ServerLink[];
relations: { parent: ServerRelation | null; children: ServerRelation[] };
}
export type AlertSeverity = "critical" | "warning" | "info";
@@ -547,6 +580,10 @@ export interface AlertItem {
silenced: boolean;
/** What a maintenance window would go on to silence it — what the Silence button acts on. Null when nothing can silence it. */
target?: { type: MaintenanceTargetType; id: number; name: string } | null;
/** Held back because another problem explains it (a guest down because its host is): the host's alert says so too. */
causedBy?: { name: string };
/** On a host's alert: the servers on it whose own alerts are folded under this one. */
affects?: string[];
/** The osTicket ticket opened for it, if one was. */
ticket?: { number: string | null; url: string | null; grouped: boolean; openedAt: string | null } | null;
}
@@ -590,7 +627,7 @@ export interface AlertTicketOverview {
export interface AlertsReport {
alerts: AlertItem[];
counts: { critical: number; warning: number; info: number; silenced: number };
counts: { critical: number; warning: number; info: number; silenced: number; grouped: number };
couldntCheck: { name: string; error: string; affects: string[] }[];
notes: string[];
generatedAt: string;
@@ -654,6 +691,34 @@ export interface ServerUpdateInput {
proxmoxGuestType?: "qemu" | "lxc" | null;
proxmoxVmid?: number | null;
hideProxmoxLink?: boolean;
/** The server this one runs on; null goes back to working it out from the Proxmox node. */
parentServerId?: number | null;
}
/** A maintenance that repeats: "every Sunday 02:00–04:00 on these servers". */
export interface MaintenanceSchedule {
id: number;
name: string;
reason: string | null;
/** 0 = Sunday … 6 = Saturday. */
days: number[];
startTime: string;
durationMinutes: number;
timezone: string;
enabled: boolean;
createdBy: string | null;
targets: { type: MaintenanceTargetType; id: number; name: string; kind: string }[];
nextStart: string | null;
}
export interface MaintenanceScheduleInput {
name: string;
reason?: string;
targets: { type: MaintenanceTargetType; id: number }[];
days: number[];
startTime: string;
durationMinutes: number;
timezone: string;
}
export type ScheduleType = "cron" | "systemd_timer" | "windows_task" | "docker" | "backup" | "update" | "n8n_workflow" | "manual";
@@ -1230,6 +1295,12 @@ export const api = {
startBulk: (data: { scope: MaintenanceBulkScope; minutes: number; reason?: string }) =>
request<{ started: number; extended: number; total: number }>("/api/maintenance/bulk", { method: "POST", body: JSON.stringify(data) }),
endAll: () => request<{ ended: number }>("/api/maintenance/end-all", { method: "POST" }),
schedules: {
list: () => request<{ schedules: MaintenanceSchedule[] }>("/api/maintenance/schedules"),
create: (data: MaintenanceScheduleInput) => request<{ id: number; windowsMade: number }>("/api/maintenance/schedules", { method: "POST", body: JSON.stringify(data) }),
setEnabled: (id: number, enabled: boolean) => request<{ enabled: boolean }>(`/api/maintenance/schedules/${id}`, { method: "PATCH", body: JSON.stringify({ enabled }) }),
remove: (id: number) => request<void>(`/api/maintenance/schedules/${id}`, { method: "DELETE" }),
},
syncUptimeKuma: (data: { integrationId: number }) =>
request<UptimeKumaSyncResult>("/api/maintenance/sync/uptimekuma", { method: "POST", body: JSON.stringify(data) }),
importUptimeKuma: (data: { integrationId: number; minutes: number }) =>
@@ -1387,6 +1458,7 @@ export const api = {
update: (id: number, data: ServerUpdateInput) =>
request<{ server: ServerRecord }>(`/api/servers/${id}`, { method: "PATCH", body: JSON.stringify(data) }),
summary: () => request<ServerSummary>("/api/servers/summary"),
updates: () => request<{ servers: UpdatesServer[] }>("/api/servers/updates"),
detail: (id: number) => request<ServerDetail>(`/api/servers/${id}/detail`),
activity: (id: number) => request<{ events: ServerActivityEvent[] }>(`/api/servers/${id}/activity`),
metrics: (id: number, days: number) => request<{ days: number; series: ServerMetricSeries[] }>(`/api/servers/${id}/metrics?days=${days}`),
@@ -1552,11 +1624,14 @@ export const api = {
semaphore: {
templates: (integrationId: number) =>
request<SemaphoreTemplatesResponse>(`/api/integrations/${integrationId}/semaphore/templates`),
run: (integrationId: number, projectId: number, templateId: number) =>
/** `limit` runs it on those hosts only (ansible's --limit). */
run: (integrationId: number, projectId: number, templateId: number, options?: { limit?: string }) =>
request<{ task: SemaphoreTask }>(
`/api/integrations/${integrationId}/semaphore/projects/${projectId}/templates/${templateId}/run`,
{ method: "POST" },
{ method: "POST", body: JSON.stringify(options ?? {}) },
),
task: (integrationId: number, projectId: number, taskId: number) =>
request<{ task: SemaphoreTask }>(`/api/integrations/${integrationId}/semaphore/projects/${projectId}/tasks/${taskId}`),
},
proxmox: {
guests: (integrationId: number) => request<ProxmoxGuestsResponse>(`/api/integrations/${integrationId}/proxmox/guests`),