What is normal for the time: baselines per hour of the week
Each server's CPU load and memory use get a baseline for every hour of the week (median and robust spread over up to ten weeks, four needed). A clearly high last hour that never dropped back toward normal is a warning; everything else stays quiet. Server History -> Trends draws a usual line and band. Setting under Notifications, on by default. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
232a5661ab
commit
31044b2b64
17 files changed
+619
-10
No files matched your search
@@ -13,6 +13,7 @@ import { describeDiagnostics, parseDiagnostics } from "../services/agentDiagnost
|
||||
import { checkThresholds, parseThresholds } from "../services/serverThresholds.js";
|
||||
import { latestAgentVersions } from "../services/agentVersions.js";
|
||||
import { getServerMetrics, MAX_RANGE_DAYS } from "../services/serverMetrics.js";
|
||||
import { baselineView } from "../services/baselines.js";
|
||||
import { getServerActivity } from "../services/serverActivity.js";
|
||||
import { asyncHandler } from "../utils/asyncHandler.js";
|
||||
import { ID_PATTERNS } from "../utils/pathSegment.js";
|
||||
@@ -277,6 +278,15 @@ serversRouter.get("/:id/metrics", asyncHandler(async (req, res) => {
|
||||
res.json({ days, series: await getServerMetrics(id, days) });
|
||||
}));
|
||||
|
||||
// What is normal for each hour of the week, for the "usual" band on the trend charts (services/baselines.ts).
|
||||
serversRouter.get("/:id/baseline", asyncHandler(async (req, res) => {
|
||||
const id = Number(req.params.id);
|
||||
if (!Number.isInteger(id)) return res.status(400).json({ error: "invalid_id" });
|
||||
const [server] = await db.select({ id: servers.id }).from(servers).where(eq(servers.id, id)).limit(1);
|
||||
if (!server) return res.status(404).json({ error: "not_found" });
|
||||
res.json(await baselineView(id, (await getSettings()).notifications.timezone || "UTC"));
|
||||
}));
|
||||
|
||||
// What has happened to a server: changes to it, the health check seeing it stop reporting or a disk fill, and its maintenance
|
||||
// windows. Operators and above — the audit log it draws on is theirs to read.
|
||||
serversRouter.get("/:id/activity", requireRole("operator"), asyncHandler(async (req, res) => {
|
||||
|
||||
@@ -144,7 +144,7 @@ const updateSchema = z.object({
|
||||
.partial()
|
||||
.optional(),
|
||||
healthChecks: z
|
||||
.object({ serverOfflineMinutes: z.number().int().min(15).max(10080), diskUsagePercent: z.number().int().min(50).max(99), domainWarnDays: z.number().int().min(1).max(365), diskForecastDays: z.number().int().min(0).max(90), backupStaleHours: z.number().int().min(0).max(2160), restoreTestDays: z.number().int().min(0).max(730), newPortAlerts: z.boolean(), flapRaises: z.number().int().min(0).max(20), deviceOfflineMinutes: z.number().int().min(5).max(1440), osSupportWarnDays: z.number().int().min(0).max(365) })
|
||||
.object({ serverOfflineMinutes: z.number().int().min(15).max(10080), diskUsagePercent: z.number().int().min(50).max(99), domainWarnDays: z.number().int().min(1).max(365), diskForecastDays: z.number().int().min(0).max(90), backupStaleHours: z.number().int().min(0).max(2160), restoreTestDays: z.number().int().min(0).max(730), newPortAlerts: z.boolean(), flapRaises: z.number().int().min(0).max(20), deviceOfflineMinutes: z.number().int().min(5).max(1440), osSupportWarnDays: z.number().int().min(0).max(365), baselineAlerts: z.boolean() })
|
||||
.partial()
|
||||
.optional(),
|
||||
quietHours: z
|
||||
|
||||
Reference in new issue
Block a user