Heartbeats, Coming up and suggested checks; Operations menu tidied

Heartbeats: a cron job or script calls /api/heartbeat/<token> (and /start, /fail); the app
alerts when the call is late or the job says it failed. Coming up: one agenda of everything
dated (expiries, warranties, end of support, planned and recurring maintenance, restore tests,
waiting updates), with a dashboard card and an iCalendar feed behind a share link. Suggested
checks: web ports and certificates the app already knows about, added with a click.

Menu: Incidents become Alerts -> History (old /incidents links redirect); new Monitoring group
(Endpoints, Heartbeats, Uptime Kuma); osTicket under Automation, Admin Links under
Infrastructure, Generator under Administration. Also makes the restore-test metrics test follow
the real clock.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-19 21:42:34 +02:00
1 parent c05c847d17
commit 4e0c6927b2
44 files changed
+7092 -75

No files matched your search

+83 -1
View File
@@ -16,7 +16,7 @@ export interface CurrentUser {
export type ShareLinkDetail = "summary" | "names";
export type ShareLinkKind = "wall" | "status";
export type ShareLinkKind = "wall" | "status" | "calendar";
export type StatusItemKind = "server" | "integration" | "monitor";
/** One thing on a status page, as the editor sees it. */
@@ -905,6 +905,74 @@ export interface EndpointInput {
enabled?: boolean;
}
/** A check the app could set up for you, from what it already knows. */
export interface EndpointSuggestion {
key: string;
kind: "http" | "tls";
name: string;
target: string;
port: number | null;
serverId: number | null;
serverName: string | null;
reason: string;
}
export type HeartbeatState = "off" | "waiting" | "up" | "running" | "late" | "failed";
/** A job that reports in: a cron job or backup script calls its address when it finishes. */
export interface Heartbeat {
id: number;
name: string;
periodMinutes: number;
graceMinutes: number;
serverId: number | null;
enabled: boolean;
notes: string | null;
lastPingAt: string | null;
lastStatus: "ok" | "fail" | null;
lastMessage: string | null;
lastDurationMs: number | null;
lastStartAt: string | null;
pingCount: number;
createdAt: string;
/** The address to call, without the host; only administrators are given it. */
path: string | null;
state: HeartbeatState;
/** ISO — when the next call is due by, counting the grace. */
dueBy: string;
server: { id: number; name: string } | null;
recent: { at: string; kind: "ok" | "fail"; durationMs: number | null }[];
}
export interface HeartbeatInput {
name: string;
periodMinutes: number;
graceMinutes?: number;
serverId?: number | null;
notes?: string | null;
enabled?: boolean;
}
export type AgendaKind = "secret" | "certificate" | "domain" | "tailscale" | "warranty" | "support" | "maintenance" | "restore" | "updates";
export interface AgendaItem {
id: string;
kind: AgendaKind;
/** YYYY-MM-DD for a day; an ISO time for maintenance. */
at: string;
endsAt: string | null;
allDay: boolean;
title: string;
detail: string | null;
link: string;
serverId: number | null;
/** Whole days from today; negative once it has passed. */
daysLeft: number;
}
export interface Agenda {
generatedAt: string;
today: string;
items: AgendaItem[];
notes: string[];
}
export type ChangeKind = "servers" | "maintenance" | "alerts" | "settings" | "integrations" | "dependencies" | "inventory" | "backups" | "endpoints" | "other";
export interface ChangeEntry {
id: string;
@@ -1891,6 +1959,20 @@ export const api = {
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" }),
suggestions: () => request<{ suggestions: EndpointSuggestion[]; dismissed: EndpointSuggestion[] }>("/api/endpoints/suggestions"),
addSuggestions: (keys: string[]) => request<{ added: { id: number; name: string }[] }>("/api/endpoints/suggestions/add", { method: "POST", body: JSON.stringify({ keys }) }),
dismissSuggestions: (keys: string[]) => request<{ suggestions: EndpointSuggestion[]; dismissed: EndpointSuggestion[] }>("/api/endpoints/suggestions/dismiss", { method: "POST", body: JSON.stringify({ keys }) }),
restoreSuggestions: () => request<{ suggestions: EndpointSuggestion[]; dismissed: EndpointSuggestion[] }>("/api/endpoints/suggestions/restore", { method: "POST" }),
},
heartbeats: {
list: () => request<{ heartbeats: Heartbeat[]; servers: { id: number; name: string }[]; baseUrl: string | null }>("/api/heartbeats"),
create: (data: HeartbeatInput) => request<{ heartbeat: Heartbeat }>("/api/heartbeats", { method: "POST", body: JSON.stringify(data) }),
update: (id: number, data: HeartbeatInput) => request<{ heartbeat: Heartbeat }>(`/api/heartbeats/${id}`, { method: "PUT", body: JSON.stringify(data) }),
remove: (id: number) => request<void>(`/api/heartbeats/${id}`, { method: "DELETE" }),
newAddress: (id: number) => request<{ path: string }>(`/api/heartbeats/${id}/new-address`, { method: "POST" }),
},
agenda: {
get: (days = 400) => request<Agenda>(`/api/agenda?days=${days}`),
},
changes: {
list: (params: { days?: number; kind?: string; serverId?: number; q?: string; before?: string; limit?: number }) => {