Racks, notes and to-do, OS support, suggested dependencies, Nginx Proxy Manager and Home Assistant
- Racks page and a network diagram (UniFi tree with servers, printable) - Notes on servers and devices; To do list shown in Coming up and My work - Agents report the operating system (Linux 7, Windows 6); end-of-life badge and alert - Suggested dependencies from where a service is reached - Nginx Proxy Manager integration: proxy hosts page, certificate and host alerts, suggested checks - Home Assistant integration: watch chosen entities, history chart, limit and unavailable alerts - TimeChart gets a "value" scale that fits negatives; docs updated Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
68b41b5586
commit
18ceed62e8
77 files changed
+20432
-35
No files matched your search
@@ -11,8 +11,11 @@
|
||||
*/
|
||||
import { eq } from "drizzle-orm";
|
||||
import { db } from "../db/client.js";
|
||||
import { endpointChecks, heartbeats, integrations, networkDevices, secrets, servers } from "../db/schema.js";
|
||||
import { endpointChecks, haEntities, haWatched, heartbeats, integrations, networkDevices, secrets, servers } from "../db/schema.js";
|
||||
import { disksFillingSoon, getForecastSeries } from "./serverMetrics.js";
|
||||
import { daysOfSupportLeft, lifecycleOf } from "./osLifecycle.js";
|
||||
import { npmIntegrationIds, npmProblems, readNpm } from "./npmReader.js";
|
||||
import { haProblems, haSyncStatuses, isHaFresh } from "./homeAssistantSync.js";
|
||||
import { diskLimit, effectiveThresholds, parseThresholds } from "./serverThresholds.js";
|
||||
import { getBackupCoverage, staleBackups } from "./backupCoverage.js";
|
||||
import { recordFromReport } from "./incidents.js";
|
||||
@@ -65,6 +68,8 @@ const SOURCES: Record<string, { label: string; link: string }> = {
|
||||
uptimekuma: { label: "Uptime Kuma", link: "/uptime-kuma" },
|
||||
osticket: { label: "osTicket", link: "/osticket" },
|
||||
unifi: { label: "UniFi", link: "/network/devices" },
|
||||
npm: { label: "Nginx Proxy Manager", link: "/proxy-hosts" },
|
||||
homeassistant: { label: "Home Assistant", link: "/home-assistant" },
|
||||
secrets: { label: "Secrets", link: "/secrets" },
|
||||
domains: { label: "Domains", link: "/dns?view=domains" },
|
||||
endpoint: { label: "Endpoint", link: "/endpoints" },
|
||||
@@ -515,6 +520,67 @@ export async function collectAlerts(): Promise<AlertsReport> {
|
||||
}
|
||||
}),
|
||||
|
||||
// Certificates in use by Nginx Proxy Manager that are running out, and hosts it could not set up.
|
||||
check("Nginx Proxy Manager", async () => {
|
||||
for (const i of await npmIntegrationIds()) {
|
||||
const read = await readNpm(i.id);
|
||||
if (!read.snapshot) {
|
||||
cannotCheck(`Nginx Proxy Manager “${i.name}”`, read.error ?? "couldn't be read", "Nginx Proxy Manager");
|
||||
continue;
|
||||
}
|
||||
for (const p of npmProblems(i.id, i.name, read.snapshot, new Date())) {
|
||||
push({ category: p.kind === "certificate" ? "expiry" : "monitoring", severity: p.severity, type: "npm", message: p.message, key: p.key, link: "/proxy-hosts", silenced: silencedIntegration(i.id), target: integrationTarget(i.id) });
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
// What was chosen to watch in Home Assistant: an entity that has said nothing for a while, or a number past its limit.
|
||||
check("Home Assistant", async () => {
|
||||
const statuses = await haSyncStatuses();
|
||||
const nowMs = Date.now();
|
||||
const watched = await db.select().from(haWatched);
|
||||
if (watched.length === 0) return;
|
||||
const entities = await db.select().from(haEntities);
|
||||
for (const i of intRows.filter((r) => r.type === "homeassistant" && r.enabled)) {
|
||||
const mine = watched.filter((w) => w.integrationId === i.id);
|
||||
if (mine.length === 0) continue;
|
||||
if (!isHaFresh(statuses[i.id], nowMs)) {
|
||||
cannotCheck(`Home Assistant “${i.name}”`, statuses[i.id]?.error ?? "hasn't been read yet", "Home Assistant");
|
||||
continue;
|
||||
}
|
||||
const rows = new Map(entities.filter((e) => e.integrationId === i.id).map((e) => [e.entityId, e]));
|
||||
for (const p of haProblems(i.id, i.name, mine, rows, new Date(nowMs))) {
|
||||
push({ category: "monitoring", severity: p.severity, type: "homeassistant", message: p.message, key: p.key, link: "/home-assistant", silenced: silencedIntegration(i.id), target: integrationTarget(i.id) });
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
// Not a notification either: an operating system whose support has ended (or is about to) is seen here, with the date, from what the agent says it runs.
|
||||
check("Operating system support", async () => {
|
||||
const { healthChecks } = await getSettings();
|
||||
if (!(healthChecks.osSupportWarnDays > 0)) return;
|
||||
const now = new Date();
|
||||
for (const s of await db.select({ id: servers.id, name: servers.name, osId: servers.osId, osName: servers.osName, osVersion: servers.osVersion }).from(servers)) {
|
||||
if (!s.osId) continue;
|
||||
const life = lifecycleOf({ id: s.osId, name: s.osName, version: s.osVersion });
|
||||
const left = life ? daysOfSupportLeft(life.endsOn, now) : null;
|
||||
if (!life || life.endsOn === null || left === null || left > healthChecks.osSupportWarnDays) continue;
|
||||
const ended = left < 0;
|
||||
push({
|
||||
category: "updates",
|
||||
severity: ended ? "warning" : "info",
|
||||
type: "server",
|
||||
message: ended
|
||||
? `${s.name} runs ${life.product}, whose support ended on ${life.endsOn} — it no longer gets security fixes`
|
||||
: `${s.name} runs ${life.product}, whose support ends on ${life.endsOn} (in ${plural(left, "day")})`,
|
||||
key: `os-support:${s.id}`,
|
||||
link: `/servers/${s.id}`,
|
||||
silenced: subjects.has(`server:${s.id}`),
|
||||
target: targetOf("server", s.id),
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
||||
check("Integration failures", async () => {
|
||||
const { notifications } = await getSettings();
|
||||
const failing = getFailingSources();
|
||||
|
||||
Reference in new issue
Block a user