Endpoint checks, restore tests, and a change log
- Endpoints: HTTP, TCP and TLS checks with answer time, uptime and certificate expiry; failures and expiring certificates become alerts and notifications; linked to a server for maintenance and tags - Restore tests: record when a backup was restored and how it went; failed tests always alert, overdue ones with a limit set; shown on the Backup coverage page - Change log: one filterable timeline made from the audit log and the incident record Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c3bc6bbf72
commit
92726568b7
37 files changed
+6918
-21
No files matched your search
@@ -497,6 +497,8 @@ export interface HealthCheckSettings {
|
||||
diskForecastDays: number;
|
||||
/** A Proxmox guest whose newest backup is older than this many hours is raised as stale; 0 is off. */
|
||||
backupStaleHours: number;
|
||||
/** A restore test older than this many days is a problem; 0 = off (a failed test always is). */
|
||||
restoreTestDays: number;
|
||||
}
|
||||
|
||||
export interface QuietHoursSettings {
|
||||
@@ -810,9 +812,34 @@ export interface CoverageGuest {
|
||||
status: CoverageStatus;
|
||||
failure: string | null;
|
||||
server: { id: number; name: string } | null;
|
||||
/** The key a restore test of this guest is recorded under. */
|
||||
restoreKey?: string;
|
||||
/** How the newest restore test of it went. */
|
||||
restoreTest?: RestoreInfo;
|
||||
}
|
||||
|
||||
export type RestoreResult = "ok" | "partial" | "failed" | "not_needed";
|
||||
export type RestoreStatus = RestoreResult | "never" | "stale";
|
||||
export interface RestoreInfo {
|
||||
status: RestoreStatus;
|
||||
testedAt: string | null;
|
||||
ageDays: number | null;
|
||||
note: string | null;
|
||||
testedBy: string | null;
|
||||
}
|
||||
export interface RestoreTestEntry {
|
||||
id: number;
|
||||
subjectKey: string;
|
||||
label: string;
|
||||
testedAt: string;
|
||||
result: RestoreResult;
|
||||
note: string | null;
|
||||
testedBy: string | null;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface BackupCoverage {
|
||||
restoreTestDays?: number;
|
||||
guests: CoverageGuest[];
|
||||
counts: Record<CoverageStatus, number> & { total: number };
|
||||
sources: { kind: "proxmox" | "pbs"; name: string; ok: boolean; error?: string }[];
|
||||
@@ -820,6 +847,68 @@ export interface BackupCoverage {
|
||||
generatedAt: string;
|
||||
}
|
||||
|
||||
export type EndpointKind = "http" | "tcp" | "tls";
|
||||
export interface EndpointStats {
|
||||
uptime24h: number | null;
|
||||
uptime7d: number | null;
|
||||
avgMs24h: number | null;
|
||||
recent: { at: string; ok: boolean; ms: number | null }[];
|
||||
}
|
||||
export interface EndpointCheck {
|
||||
id: number;
|
||||
name: string;
|
||||
kind: EndpointKind;
|
||||
target: string;
|
||||
port: number | null;
|
||||
expectStatus: string | null;
|
||||
keyword: string | null;
|
||||
insecure: boolean;
|
||||
intervalMinutes: number;
|
||||
timeoutSeconds: number;
|
||||
failuresBeforeAlert: number;
|
||||
warnDays: number;
|
||||
serverId: number | null;
|
||||
enabled: boolean;
|
||||
lastCheckedAt: string | null;
|
||||
lastOk: boolean | null;
|
||||
lastMessage: string | null;
|
||||
lastResponseMs: number | null;
|
||||
certExpiresAt: string | null;
|
||||
consecutiveFailures: number;
|
||||
lastChangeAt: string | null;
|
||||
server: { id: number; name: string } | null;
|
||||
stats?: EndpointStats;
|
||||
}
|
||||
export interface EndpointInput {
|
||||
name: string;
|
||||
kind: EndpointKind;
|
||||
target: string;
|
||||
port?: number | null;
|
||||
expectStatus?: string | null;
|
||||
keyword?: string | null;
|
||||
insecure?: boolean;
|
||||
intervalMinutes?: number;
|
||||
timeoutSeconds?: number;
|
||||
failuresBeforeAlert?: number;
|
||||
warnDays?: number;
|
||||
serverId?: number | null;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type ChangeKind = "servers" | "maintenance" | "alerts" | "settings" | "integrations" | "dependencies" | "inventory" | "backups" | "endpoints" | "other";
|
||||
export interface ChangeEntry {
|
||||
id: string;
|
||||
at: string;
|
||||
kind: ChangeKind;
|
||||
tone: "good" | "bad" | "neutral" | "info";
|
||||
title: string;
|
||||
detail: string | null;
|
||||
actor: string | null;
|
||||
target: { type: string; id: string | null; name: string | null } | null;
|
||||
link: string | null;
|
||||
serverId: number | null;
|
||||
}
|
||||
|
||||
export type AssetKind = "server" | "storage" | "network" | "power" | "client" | "other";
|
||||
|
||||
export type DependencyNodeType = "server" | "integration";
|
||||
@@ -1757,6 +1846,23 @@ export const api = {
|
||||
},
|
||||
backups: {
|
||||
coverage: (staleDays: number, refresh = false) => request<BackupCoverage>(`/api/backups/coverage?staleDays=${staleDays}${refresh ? "&refresh=1" : ""}`),
|
||||
restoreTests: () => request<{ limitDays: number; tests: RestoreTestEntry[]; custom: (RestoreInfo & { key: string; label: string })[] }>("/api/backups/restore-tests"),
|
||||
recordRestoreTest: (data: { key?: string; label: string; testedAt?: string; result: RestoreResult; note?: string }) => request<{ test: RestoreTestEntry }>("/api/backups/restore-tests", { method: "POST", body: JSON.stringify(data) }),
|
||||
removeRestoreTest: (id: number) => request<void>(`/api/backups/restore-tests/${id}`, { method: "DELETE" }),
|
||||
},
|
||||
endpoints: {
|
||||
list: () => request<{ checks: EndpointCheck[]; servers: { id: number; name: string }[] }>("/api/endpoints"),
|
||||
create: (data: EndpointInput) => request<{ check: EndpointCheck }>("/api/endpoints", { method: "POST", body: JSON.stringify(data) }),
|
||||
update: (id: number, data: EndpointInput) => request<{ check: EndpointCheck }>(`/api/endpoints/${id}`, { method: "PUT", body: JSON.stringify(data) }),
|
||||
remove: (id: number) => request<void>(`/api/endpoints/${id}`, { method: "DELETE" }),
|
||||
check: (id: number) => request<{ result: { ok: boolean; ms: number | null; message: string } }>(`/api/endpoints/${id}/check`, { method: "POST" }),
|
||||
},
|
||||
changes: {
|
||||
list: (params: { days?: number; kind?: string; serverId?: number; q?: string; before?: string; limit?: number }) => {
|
||||
const q = new URLSearchParams();
|
||||
for (const [k, v] of Object.entries(params)) if (v !== undefined && v !== "") q.set(k, String(v));
|
||||
return request<{ entries: ChangeEntry[]; more: boolean; kinds: { id: ChangeKind; label: string }[] }>(`/api/changes?${q.toString()}`);
|
||||
},
|
||||
},
|
||||
push: {
|
||||
key: () => request<{ publicKey: string }>("/api/push/key"),
|
||||
|
||||
Reference in new issue
Block a user