Runbooks per alert kind, high-vulnerability threshold, wall display extras
A "What to do" note (text and/or link) can be written once for a whole kind of alert and shows beside every alert of that kind; alerts now carry their kind and source type. New optional setting: warn when a Docker host has N or more high vulnerabilities (off by default). The wall display gains tiles (Hetzner and game servers running, critical vulnerabilities, stuck downloads) and a summary line for each group of integrations, also in share links. Migration 0074; docs and tests included. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d9083adb5b
commit
3d9a2310bb
35 files changed
+9129
-30
No files matched your search
@@ -67,6 +67,23 @@ export interface ShareLink {
|
||||
}
|
||||
|
||||
/** What a share link may show: numbers, and with "names" also the names of what is wrong. Built on the server. */
|
||||
/** An extra tile on the wall display (Hetzner servers running, critical vulnerabilities …). */
|
||||
export interface WallTile {
|
||||
id: string;
|
||||
label: string;
|
||||
figure: string;
|
||||
state: "ok" | "warn" | "bad" | "info";
|
||||
}
|
||||
|
||||
/** A summary of one group of integrations (the menu's Infrastructure, Apps …) for the wall display: how many are connected, failing, and how many alerts they have. */
|
||||
export interface WallGroup {
|
||||
id: string;
|
||||
label: string;
|
||||
integrations: number;
|
||||
failing: number;
|
||||
alerts: { critical: number; warning: number };
|
||||
}
|
||||
|
||||
export interface PublicWall {
|
||||
detail: ShareLinkDetail;
|
||||
level: "ok" | "warning" | "critical" | "unsure";
|
||||
@@ -75,6 +92,8 @@ export interface PublicWall {
|
||||
alerts: { critical: number; warning: number };
|
||||
maintenance: number;
|
||||
integrationsFailing: number;
|
||||
tiles?: WallTile[];
|
||||
groups?: WallGroup[];
|
||||
problems?: { id: string; severity: "critical" | "warning"; message: string }[];
|
||||
maintenanceWindows?: { id: number; name: string; endsAt: string }[];
|
||||
integrations?: { id: number; name: string; type: string; status: "ok" | "failing" | "unknown" }[];
|
||||
@@ -540,6 +559,8 @@ export interface HealthCheckSettings {
|
||||
/** A container that keeps restarting, is unhealthy, stopped unexpectedly or never started, and a Docker host that cannot be reached, is an alert. */
|
||||
containerAlerts: boolean;
|
||||
vulnerabilityAlerts: boolean;
|
||||
/** A Docker host with at least this many high findings is a warning too; 0 = off. */
|
||||
vulnerabilityHighThreshold: number;
|
||||
/** Containers to leave alone: a name, or "host/name"; * stands for anything. */
|
||||
containerIgnore: string[];
|
||||
}
|
||||
@@ -2150,11 +2171,26 @@ export interface Runbook {
|
||||
/** A runbook's title and what it is for, without its text. */
|
||||
export type RunbookSummary = Pick<Runbook, "id" | "targetType" | "targetId" | "category" | "title">;
|
||||
|
||||
/** What to do first about a kind of alert ("disk", "hetzner-cert" …), whichever server or integration it is about. */
|
||||
export interface AlertKindRunbook {
|
||||
kind: string;
|
||||
title: string;
|
||||
body: string;
|
||||
/** A page to open; null when there is none. */
|
||||
url: string | null;
|
||||
updatedBy: string | null;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export type AlertSeverity = "critical" | "warning" | "info";
|
||||
export type AlertCategory = "offline" | "disk" | "services" | "backup" | "updates" | "expiry" | "automation" | "integration" | "monitoring" | "tickets";
|
||||
|
||||
export interface AlertItem {
|
||||
id: string;
|
||||
/** What kind of alert it is: the first part of its key ("disk", "hetzner-cert"). A runbook can be written for a kind. */
|
||||
kind: string;
|
||||
/** The kind of source it is about: an integration's type, "server" … */
|
||||
type: string;
|
||||
severity: AlertSeverity;
|
||||
category: AlertCategory;
|
||||
source: string;
|
||||
@@ -2804,6 +2840,8 @@ export interface DockhandVulnerabilityEnvironment {
|
||||
export interface DockhandVulnerabilitiesResponse {
|
||||
/** Whether critical findings are alerted (Settings → Notifications). */
|
||||
alerts: boolean;
|
||||
/** A host with at least this many high findings is alerted too; 0 = never. */
|
||||
highThreshold: number;
|
||||
status: { at: string; ok: boolean; error: string | null } | null;
|
||||
fresh: boolean;
|
||||
environments: DockhandVulnerabilityEnvironment[];
|
||||
@@ -3380,6 +3418,11 @@ export const api = {
|
||||
update: (id: number, data: { title: string; body: string; category: AlertCategory | null }) =>
|
||||
request<{ runbook: Runbook }>(`/api/runbooks/${id}`, { method: "PUT", body: JSON.stringify(data) }),
|
||||
remove: (id: number) => request<void>(`/api/runbooks/${id}`, { method: "DELETE" }),
|
||||
kinds: {
|
||||
list: () => request<{ kinds: AlertKindRunbook[] }>("/api/runbooks/kinds"),
|
||||
save: (kind: string, data: { title: string; body: string; url: string | null }) => request<{ runbook: AlertKindRunbook }>(`/api/runbooks/kinds/${encodeURIComponent(kind)}`, { method: "PUT", body: JSON.stringify(data) }),
|
||||
remove: (kind: string) => request<void>(`/api/runbooks/kinds/${encodeURIComponent(kind)}`, { method: "DELETE" }),
|
||||
},
|
||||
},
|
||||
shareLinks: {
|
||||
list: () => request<{ links: ShareLink[] }>("/api/share-links"),
|
||||
@@ -3401,6 +3444,9 @@ export const api = {
|
||||
},
|
||||
},
|
||||
// Opened by someone who isn't signed in: no cookies, and the status is kept so a link that has ended can say so.
|
||||
wall: {
|
||||
extras: () => request<{ tiles: WallTile[]; groups: WallGroup[] }>("/api/wall/extras"),
|
||||
},
|
||||
publicWall: {
|
||||
get: async (token: string): Promise<PublicWall> => {
|
||||
const res = await fetch(`/api/public/wall/${encodeURIComponent(token)}`, { credentials: "omit", cache: "no-store" });
|
||||
|
||||
Reference in new issue
Block a user