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" });
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
import { useState } from "react";
|
||||
import { IconBook, IconExternalLink } from "@tabler/icons-react";
|
||||
import { api, type AlertKindRunbook } from "../api/client";
|
||||
import { ALERT_KIND_RUNBOOKS_CHANGED, useAlertKindRunbooks } from "../hooks/useAlertKindRunbooks";
|
||||
import { readableError } from "../utils/errors";
|
||||
import { removeWithUndo } from "../utils/undoable";
|
||||
import { toast } from "../utils/toast";
|
||||
import DetailDrawer from "./DetailDrawer";
|
||||
import RunbookText from "./RunbookText";
|
||||
import TimeAgo from "./TimeAgo";
|
||||
|
||||
/** How a kind of alert reads in a sentence; any kind not listed is its own name with the dashes taken out. */
|
||||
const KIND_WORDS: Record<string, string> = {
|
||||
offline: "a server that stopped reporting",
|
||||
disk: "a disk filling up",
|
||||
"failed-units": "failed services",
|
||||
smart: "a disk reporting trouble",
|
||||
zfs: "a ZFS pool in trouble",
|
||||
"docker-vuln": "critical vulnerabilities in Docker images",
|
||||
"docker-vuln-high": "many high vulnerabilities in Docker images",
|
||||
"container-restarting": "a container that keeps restarting",
|
||||
"container-unhealthy": "an unhealthy container",
|
||||
"container-stopped": "a container that stopped",
|
||||
"hetzner-off": "a Hetzner server that is off",
|
||||
"hetzner-traffic": "a Hetzner traffic quota nearly used",
|
||||
"hetzner-forecast": "a Hetzner traffic quota the month will pass",
|
||||
"hetzner-backup": "a Hetzner backup that is late",
|
||||
"hetzner-lb": "an unhealthy Hetzner load balancer",
|
||||
"hetzner-cert": "a Hetzner certificate about to end",
|
||||
"hetzner-fip": "a Hetzner floating IP pointing at nothing",
|
||||
"fragnet-backup": "a game server backup that is late",
|
||||
"fragnet-disk": "a game server disk filling up",
|
||||
"fragnet-memory": "a game server's memory running out",
|
||||
"sonarr-health": "Sonarr reporting a problem",
|
||||
"sonarr-queue": "stuck downloads in Sonarr",
|
||||
"radarr-health": "Radarr reporting a problem",
|
||||
"radarr-queue": "stuck downloads in Radarr",
|
||||
"prowlarr-health": "Prowlarr reporting a problem",
|
||||
"speedtest-slow": "a slow internet line",
|
||||
"speedtest-failing": "failing speed tests",
|
||||
};
|
||||
|
||||
export const kindWords = (kind: string): string => KIND_WORDS[kind] ?? `${kind.replace(/[-_]+/g, " ")} alerts`;
|
||||
|
||||
/**
|
||||
* A small "What to do" link beside an alert: what is written down for this KIND of alert, whichever server or integration it is about (the runbooks of one thing
|
||||
* are the other link). Shown where there is something to read and, for those who can write them, a quiet "Add what to do" where there is not. A link, if one was
|
||||
* given, opens in a new tab from the panel.
|
||||
*/
|
||||
export default function AlertKindRunbookEntry({ kind, canEdit, offerAdd = true }: { kind: string; canEdit: boolean; /** Show "Add what to do" for those who can, when there is none. */ offerAdd?: boolean }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const all = useAlertKindRunbooks();
|
||||
const here = all?.find((r) => r.kind === kind) ?? null;
|
||||
if (all === null || (here === null && !(canEdit && offerAdd))) return null;
|
||||
return (
|
||||
<>
|
||||
<button
|
||||
type="button"
|
||||
className={`btn btn-link btn-sm p-0 d-inline-flex align-items-center gap-1 align-baseline ${here ? "" : "text-secondary"}`}
|
||||
title={here ? here.title : `Write down what to do about ${kindWords(kind)}`}
|
||||
onClick={() => setOpen(true)}
|
||||
>
|
||||
<IconBook size={14} aria-hidden="true" />
|
||||
{here ? "What to do" : "Add what to do"}
|
||||
</button>
|
||||
{open && (
|
||||
<DetailDrawer title="What to do" subtitle={kindWords(kind)} onClose={() => setOpen(false)}>
|
||||
<Panel kind={kind} existing={here} canEdit={canEdit} onDone={() => setOpen(false)} />
|
||||
</DetailDrawer>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
function Panel({ kind, existing, canEdit, onDone }: { kind: string; existing: AlertKindRunbook | null; canEdit: boolean; onDone: () => void }) {
|
||||
const [editing, setEditing] = useState(existing === null && canEdit);
|
||||
const [title, setTitle] = useState(existing?.title ?? `If it is ${kindWords(kind)}`);
|
||||
const [body, setBody] = useState(existing?.body ?? "");
|
||||
const [url, setUrl] = useState(existing?.url ?? "");
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const changed = () => window.dispatchEvent(new Event(ALERT_KIND_RUNBOOKS_CHANGED));
|
||||
|
||||
async function save(e: React.FormEvent) {
|
||||
e.preventDefault();
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
await api.runbooks.kinds.save(kind, { title: title.trim(), body, url: url.trim() === "" ? null : url.trim() });
|
||||
toast.success("Saved.");
|
||||
changed();
|
||||
onDone();
|
||||
} catch (err) {
|
||||
setError(readableError(err));
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
async function remove() {
|
||||
if (!existing) return;
|
||||
onDone();
|
||||
await removeWithUndo({
|
||||
remove: () => api.runbooks.kinds.remove(kind),
|
||||
restore: () => api.runbooks.kinds.save(kind, { title: existing.title, body: existing.body, url: existing.url }),
|
||||
message: `Removed "${existing.title}".`,
|
||||
reload: changed,
|
||||
});
|
||||
}
|
||||
|
||||
if (!editing && existing) {
|
||||
return (
|
||||
<div>
|
||||
<div className="fw-bold mb-2">{existing.title}</div>
|
||||
{existing.url && (
|
||||
<p>
|
||||
<a className="btn btn-sm btn-outline-primary" href={existing.url} target="_blank" rel="noopener noreferrer">
|
||||
<IconExternalLink size={14} className="me-1" aria-hidden="true" />
|
||||
Open the page
|
||||
</a>{" "}
|
||||
<span className="text-secondary small text-break">{existing.url}</span>
|
||||
</p>
|
||||
)}
|
||||
{existing.body.trim() !== "" && <RunbookText text={existing.body} />}
|
||||
<div className="d-flex flex-wrap align-items-center gap-2 mt-3">
|
||||
<span className="text-secondary small">
|
||||
For every alert of this kind. {existing.updatedBy ? `${existing.updatedBy}, ` : ""}
|
||||
<TimeAgo value={existing.updatedAt} />
|
||||
</span>
|
||||
{canEdit && (
|
||||
<span className="ms-auto btn-list flex-nowrap">
|
||||
<button type="button" className="btn btn-sm btn-outline-secondary" onClick={() => setEditing(true)}>
|
||||
Edit
|
||||
</button>
|
||||
<button type="button" className="btn btn-sm btn-outline-danger" onClick={() => void remove()}>
|
||||
Remove
|
||||
</button>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={save}>
|
||||
<p className="text-secondary small">Written once, shown beside every alert of this kind — {kindWords(kind)} — on whatever it happens to. What is specific to one server or integration goes in its own runbook.</p>
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="akr-title">
|
||||
Title
|
||||
</label>
|
||||
<input id="akr-title" className="form-control" required maxLength={120} value={title} onChange={(e) => setTitle(e.target.value)} />
|
||||
</div>
|
||||
<div className="mb-3">
|
||||
<label className="form-label" htmlFor="akr-url">
|
||||
A page to open (optional)
|
||||
</label>
|
||||
<input id="akr-url" className="form-control" type="url" maxLength={500} placeholder="https://wiki.example.lan/certificates" value={url} onChange={(e) => setUrl(e.target.value)} />
|
||||
</div>
|
||||
<div className="mb-2">
|
||||
<label className="form-label" htmlFor="akr-body">
|
||||
What to do first
|
||||
</label>
|
||||
<textarea id="akr-body" className="form-control" rows={9} maxLength={20000} value={body} onChange={(e) => setBody(e.target.value)} />
|
||||
<div className="form-hint">
|
||||
Plain text. A blank line starts a new paragraph; <code>- </code> makes a list; <code>```</code> around lines makes a block of commands; links are made clickable.
|
||||
</div>
|
||||
</div>
|
||||
{error && <div className="text-danger small mb-2">{error}</div>}
|
||||
<div className="btn-list">
|
||||
<button type="submit" className="btn btn-primary" disabled={busy || title.trim() === "" || (body.trim() === "" && url.trim() === "")}>
|
||||
{busy ? "Saving…" : "Save"}
|
||||
</button>
|
||||
<button type="button" className="btn" onClick={() => (existing ? setEditing(false) : onDone())}>
|
||||
Cancel
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { useEffect, useState, type ReactNode } from "react";
|
||||
import type { WallGroup, WallTile } from "../api/client";
|
||||
import { formatDate, formatTime } from "../utils/date";
|
||||
import { formatRemaining } from "../utils/duration";
|
||||
|
||||
@@ -48,6 +49,9 @@ export interface WallData {
|
||||
problems: { id: string; severity: "critical" | "warning"; message: string }[] | null;
|
||||
windows: { id: number; name: string; endsAt: string }[] | null;
|
||||
integrations: { id: number; name: string; type: string; status: "ok" | "failing" | "unknown" }[] | null;
|
||||
/** What else is worth a glance, and a summary of each group of integrations; absent on a board that has none. */
|
||||
tiles?: WallTile[];
|
||||
groups?: WallGroup[];
|
||||
environmentName: string | null;
|
||||
updatedAt: Date | null;
|
||||
}
|
||||
@@ -141,8 +145,30 @@ export default function WallView({ data, idle, footerActions }: { data: WallData
|
||||
<div className="wall-tile-figure">{data.integrationsFailing === null ? "…" : data.integrationsFailing}</div>
|
||||
<div className="wall-tile-label">integrations failing</div>
|
||||
</div>
|
||||
{(data.tiles ?? []).map((t) => (
|
||||
<div key={t.id} className={`wall-tile ${t.state === "bad" ? "wall-tile-bad" : t.state === "warn" ? "wall-tile-warn" : t.state === "info" ? "wall-tile-info" : ""}`}>
|
||||
<div className="wall-tile-figure">{t.figure}</div>
|
||||
<div className="wall-tile-label">{t.label}</div>
|
||||
</div>
|
||||
))}
|
||||
</section>
|
||||
|
||||
{(data.groups ?? []).length > 0 && (
|
||||
<section className="wall-groups" aria-label="By area">
|
||||
{(data.groups ?? []).map((g) => {
|
||||
const alerts = g.alerts.critical + g.alerts.warning;
|
||||
const level = g.failing > 0 || g.alerts.critical > 0 ? "bad" : alerts > 0 ? "warn" : "ok";
|
||||
const parts = [g.failing > 0 ? `${g.failing} of ${g.integrations} failing` : null, alerts > 0 ? `${alerts} ${alerts === 1 ? "alert" : "alerts"}` : null].filter(Boolean);
|
||||
return (
|
||||
<div key={g.id} className={`wall-group wall-group-${level}`}>
|
||||
<span aria-hidden="true">{level === "bad" ? "✕" : level === "warn" ? "▲" : "✓"}</span> <strong>{g.label}</strong>{" "}
|
||||
<span className="wall-dim">{parts.length > 0 ? parts.join(" · ") : `${g.integrations} connected`}</span>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</section>
|
||||
)}
|
||||
|
||||
{showsDetail ? (
|
||||
<section className="wall-columns">
|
||||
<div>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
import { useEffect, useSyncExternalStore } from "react";
|
||||
import { api, type AlertKindRunbook } from "../api/client";
|
||||
|
||||
// What is written down for each kind of alert, shared by every alert on the page and fetched once — and again whenever one is added, changed or
|
||||
// removed (ALERT_KIND_RUNBOOKS_CHANGED). The texts come with the list: there are few of them, and the drawer should open at once.
|
||||
export const ALERT_KIND_RUNBOOKS_CHANGED = "alert-kind-runbooks-changed";
|
||||
|
||||
let items: AlertKindRunbook[] | null = null;
|
||||
let loading = false;
|
||||
const listeners = new Set<() => void>();
|
||||
|
||||
function load(force = false): void {
|
||||
if (loading || (items !== null && !force)) return;
|
||||
loading = true;
|
||||
api.runbooks.kinds
|
||||
.list()
|
||||
.then((res) => {
|
||||
items = res.kinds;
|
||||
listeners.forEach((l) => l());
|
||||
})
|
||||
.catch(() => {
|
||||
// Only a convenience on top of the page: without it the alerts simply show no runbook link.
|
||||
})
|
||||
.finally(() => {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof window !== "undefined") window.addEventListener(ALERT_KIND_RUNBOOKS_CHANGED, () => load(true));
|
||||
|
||||
function subscribe(listener: () => void): () => void {
|
||||
listeners.add(listener);
|
||||
return () => {
|
||||
listeners.delete(listener);
|
||||
};
|
||||
}
|
||||
|
||||
/** What is written down for each kind of alert; null until loaded. */
|
||||
export function useAlertKindRunbooks(): AlertKindRunbook[] | null {
|
||||
useEffect(() => load(), []);
|
||||
return useSyncExternalStore(subscribe, () => items);
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import TableToolbar from "../components/TableToolbar";
|
||||
import SilenceButton from "../components/SilenceButton";
|
||||
import RunPlaybookButton from "../components/RunPlaybookButton";
|
||||
import RunbookEntry from "../components/RunbookEntry";
|
||||
import AlertKindRunbookEntry from "../components/AlertKindRunbook";
|
||||
import AckDrawer, { ackWords } from "../components/AckDrawer";
|
||||
import CloseDrawer, { CloseBulkDrawer } from "../components/CloseDrawer";
|
||||
import SnoozeDrawer, { SnoozeBulkDrawer, snoozeWords } from "../components/SnoozeDrawer";
|
||||
@@ -202,6 +203,18 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
const withTicket = (report?.alerts ?? []).filter((a) => ids.has(a.id) && a.ticket?.number && !a.ticket.closedAt);
|
||||
return { closable: withTicket.filter((a) => a.ticket?.canClose).map((a) => a.ticket!.number as string), other: withTicket.filter((a) => !a.ticket?.canClose).length };
|
||||
}, [pickedIds, report]);
|
||||
// "Add what to do" is offered once for each kind of alert on the page (on the first of them), not beside every one; what has been written shows beside all of them.
|
||||
const firstOfKind = useMemo(() => {
|
||||
const seen = new Set<string>();
|
||||
const first = new Set<string>();
|
||||
for (const a of pageItems ?? []) {
|
||||
if (!seen.has(a.kind)) {
|
||||
seen.add(a.kind);
|
||||
first.add(a.id);
|
||||
}
|
||||
}
|
||||
return first;
|
||||
}, [pageItems]);
|
||||
const shownIds = useMemo(() => (sorted ?? []).filter((a) => !a.silenced).map((a) => a.id), [sorted]);
|
||||
const allShownPicked = shownIds.length > 0 && shownIds.every((id) => picked.has(id));
|
||||
function togglePicked(id: string) {
|
||||
@@ -536,9 +549,10 @@ function AlertsNow({ user, tabs }: { user: CurrentUser; tabs: React.ReactNode })
|
||||
<Link to={incidentPath(a.incidentId)}>Timeline</Link>
|
||||
</div>
|
||||
)}
|
||||
{a.target && (
|
||||
<div>
|
||||
<RunbookEntry targetType={a.target.type} targetId={a.target.id} targetName={a.target.name} canEdit={canSilence} forCategory={a.category} />
|
||||
{(a.target || a.kind) && (
|
||||
<div className="d-flex flex-wrap gap-3">
|
||||
{a.target && <RunbookEntry targetType={a.target.type} targetId={a.target.id} targetName={a.target.name} canEdit={canSilence} forCategory={a.category} />}
|
||||
{a.kind && <AlertKindRunbookEntry kind={a.kind} canEdit={canSilence} offerAdd={firstOfKind.has(a.id)} />}
|
||||
</div>
|
||||
)}
|
||||
{a.affects && a.affects.length > 0 && (
|
||||
|
||||
@@ -109,7 +109,14 @@ export default function DockerVulnerabilities({ integrationId }: { integrationId
|
||||
From the scans Dockhand has already run on its images (it scans when it is told to — nothing is scanned from here). An image that was never scanned is not known to be clean.{" "}
|
||||
{data.alerts ? (
|
||||
<>
|
||||
<strong>Critical</strong> findings are an alert — see <Link to="/alerts">Alerts</Link>; high, medium and low are only shown here.
|
||||
<strong>Critical</strong> findings are an alert — see <Link to="/alerts">Alerts</Link>;{" "}
|
||||
{data.highThreshold > 0 ? (
|
||||
<>
|
||||
so is a host with <strong>{data.highThreshold} or more high</strong> ones (<Link to="/settings/notifications">Settings → Notifications</Link>); medium and low are only shown here.
|
||||
</>
|
||||
) : (
|
||||
<>high, medium and low are only shown here (high ones can be alerted from a number you choose under Settings → Notifications).</>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
|
||||
@@ -88,6 +88,8 @@ export default function SharedWall() {
|
||||
alerts: wall ? wall.alerts : null,
|
||||
maintenance: wall?.maintenance ?? 0,
|
||||
integrationsFailing: wall ? wall.integrationsFailing : null,
|
||||
tiles: wall?.tiles,
|
||||
groups: wall?.groups,
|
||||
problems: wall?.problems ?? null,
|
||||
windows: wall?.maintenanceWindows ?? null,
|
||||
integrations: (wall?.integrations as WallData["integrations"]) ?? null,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import { Link, useNavigate } from "react-router-dom";
|
||||
import { api, type IntegrationSummary, type MaintenanceWindow, type ServerSummary } from "../api/client";
|
||||
import { api, type IntegrationSummary, type MaintenanceWindow, type ServerSummary, type WallGroup, type WallTile } from "../api/client";
|
||||
import { alertBadge, useAlertsReport } from "../hooks/useAlertsReport";
|
||||
import { useEnvironment } from "../utils/environment";
|
||||
import WallView, { REFRESH_MS, wallHeadline, type WallData } from "../components/WallView";
|
||||
@@ -16,6 +16,7 @@ export default function Wall() {
|
||||
const [servers, setServers] = useState<ServerSummary | null>(null);
|
||||
const [integrations, setIntegrations] = useState<IntegrationSummary[] | null>(null);
|
||||
const [windows, setWindows] = useState<MaintenanceWindow[]>([]);
|
||||
const [extras, setExtras] = useState<{ tiles: WallTile[]; groups: WallGroup[] } | null>(null);
|
||||
const [updatedAt, setUpdatedAt] = useState<Date | null>(null);
|
||||
const [idle, setIdle] = useState(false);
|
||||
|
||||
@@ -23,11 +24,13 @@ export default function Wall() {
|
||||
let alive = true;
|
||||
const load = () => {
|
||||
reload();
|
||||
Promise.allSettled([api.servers.summary(), api.integrations.list(), api.maintenance.list()]).then(([s, i, m]) => {
|
||||
Promise.allSettled([api.servers.summary(), api.integrations.list(), api.maintenance.list(), api.wall.extras()]).then(([s, i, m, x]) => {
|
||||
if (!alive) return;
|
||||
if (s.status === "fulfilled") setServers(s.value);
|
||||
if (i.status === "fulfilled") setIntegrations(i.value.integrations);
|
||||
if (m.status === "fulfilled") setWindows(m.value.windows);
|
||||
// The extras are only an addition: a board that cannot get them shows the rest.
|
||||
if (x.status === "fulfilled") setExtras(x.value);
|
||||
setUpdatedAt(new Date());
|
||||
});
|
||||
};
|
||||
@@ -72,6 +75,8 @@ export default function Wall() {
|
||||
alerts: report ? { critical: report.counts.critical, warning: report.counts.warning } : null,
|
||||
maintenance: windows.length,
|
||||
integrationsFailing: integrations ? failing.length : null,
|
||||
tiles: extras?.tiles,
|
||||
groups: extras?.groups,
|
||||
problems: active.map((a) => ({ id: a.id, severity: a.severity as "critical" | "warning", message: a.message })),
|
||||
windows: windows.map((w) => ({ id: w.id, name: w.targetName, endsAt: w.endsAt })),
|
||||
integrations: (integrations ?? [])
|
||||
|
||||
@@ -84,7 +84,7 @@ const DIGEST_DAYS: { value: number; label: string }[] = [
|
||||
{ value: 6, label: "Saturday" },
|
||||
{ value: 0, label: "Sunday" },
|
||||
];
|
||||
const DEFAULT_HEALTH_CHECKS: HealthCheckSettings = { serverOfflineMinutes: 60, diskUsagePercent: 90, domainWarnDays: 30, diskForecastDays: 14, backupStaleHours: 48, restoreTestDays: 0, newPortAlerts: true, flapRaises: 3, deviceOfflineMinutes: 10, osSupportWarnDays: 90, baselineAlerts: true, containerAlerts: true, vulnerabilityAlerts: true, containerIgnore: [] };
|
||||
const DEFAULT_HEALTH_CHECKS: HealthCheckSettings = { serverOfflineMinutes: 60, diskUsagePercent: 90, domainWarnDays: 30, diskForecastDays: 14, backupStaleHours: 48, restoreTestDays: 0, newPortAlerts: true, flapRaises: 3, deviceOfflineMinutes: 10, osSupportWarnDays: 90, baselineAlerts: true, containerAlerts: true, vulnerabilityAlerts: true, vulnerabilityHighThreshold: 0, containerIgnore: [] };
|
||||
const DEFAULT_MONTHLY: MonthlyReportSettings = { enabled: false, quarterly: false, annual: false, day: 1, time: "08:00" };
|
||||
|
||||
type TestResult = { ok: boolean; message: string } | null;
|
||||
@@ -904,11 +904,22 @@ export default function NotificationSettings() {
|
||||
<span className="form-check-label">
|
||||
Warn about critical vulnerabilities in Docker images
|
||||
<span className="form-hint d-block">
|
||||
From the scans Dockhand has already run (nothing is scanned from here): a warning for each Docker host whose scanned images have one or more critical findings. High, medium and low findings are shown on the Docker
|
||||
page but never alerted. Dockhand can send its own vulnerability notifications too; with both switched on you hear twice.
|
||||
From the scans Dockhand has already run (nothing is scanned from here): a warning for each Docker host whose scanned images have one or more critical findings. Medium and low findings are shown on the Docker
|
||||
page but never alerted (high ones only if you set a number below). Dockhand can send its own vulnerability notifications too; with both switched on you hear twice.
|
||||
</span>
|
||||
</span>
|
||||
</label>
|
||||
<div className="mt-3">
|
||||
<NumberField
|
||||
label="Also warn when a Docker host has this many high vulnerabilities"
|
||||
value={healthChecks.vulnerabilityHighThreshold}
|
||||
min={0}
|
||||
max={10000}
|
||||
unit="or more (0 = never)"
|
||||
hint="Off by default: scanners find high-severity issues in almost every image, so a low number is noise. Counted over the scanned images of each host, as Dockhand reports them; the critical ones are alerted either way while the box above is ticked."
|
||||
onChange={(v) => setHealthChecks((h) => ({ ...h, vulnerabilityHighThreshold: v }))}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -837,6 +837,39 @@ main:focus {
|
||||
box-shadow: inset 0 0 0 3px #4dabf7;
|
||||
}
|
||||
|
||||
/* One line for each group of integrations the menu has: a symbol, its name and how it is. */
|
||||
.wall-groups {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: clamp(0.5rem, 1.2vw, 1rem);
|
||||
}
|
||||
|
||||
.wall-group {
|
||||
padding: 0.5em 0.9em;
|
||||
background: #121c2f;
|
||||
border-radius: 999px;
|
||||
font-size: clamp(0.9rem, 1.5vw, 1.3rem);
|
||||
box-shadow: inset 0 0 0 2px transparent;
|
||||
}
|
||||
|
||||
.wall-group-ok {
|
||||
color: #8ce99a;
|
||||
}
|
||||
|
||||
.wall-group-warn {
|
||||
color: #ffc247;
|
||||
box-shadow: inset 0 0 0 2px #ffc247;
|
||||
}
|
||||
|
||||
.wall-group-bad {
|
||||
color: #ff8787;
|
||||
box-shadow: inset 0 0 0 2px #ff6b6b;
|
||||
}
|
||||
|
||||
.wall-group .wall-dim {
|
||||
color: #adb5bd;
|
||||
}
|
||||
|
||||
.wall-columns {
|
||||
display: grid;
|
||||
grid-template-columns: 3fr 2fr;
|
||||
|
||||
Reference in new issue
Block a user