Stale-backup alerts, per-server alert limits, and update runs from the Updates page
- Backups: a guest whose newest backup is older than its limit is an alert (backup kind), in the daily backup message, the digest and /metrics (homelab_backup_guests, ..._last_age_seconds) - Per-server thresholds (servers.thresholds, migration 0030): offline minutes, disk percent, forecast window, backup age, and per-disk limits or "leave alone"; applied everywhere the global ones were; saving clears the alerts cache - Update runs (update_runs, migration 0031): Update... on the Updates page puts the server under maintenance, runs a Semaphore playbook limited to it, waits for the host to report, and reports what is left and whether a restart is due; poller survives restarts - Notification toggle for update-run results; tests and docs Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5dc6cea69c
commit
7a5b623444
42 files changed
+7561
-57
No files matched your search
@@ -140,17 +140,20 @@ export const FORECAST_MIN_FIT = 0.9;
|
||||
/**
|
||||
* The disks that are heading for full within `withinDays`. A disk already at or above `alreadyAlertedAt` percent is left out — the
|
||||
* ordinary "disk nearly full" alert covers it — and so is one whose growth is erratic (a big copy, a log that rotates), where a
|
||||
* straight-line forecast would just be a guess.
|
||||
* straight-line forecast would just be a guess. `alreadyAlertedAt` may be a function of the disk, for servers with a limit of their own
|
||||
* for one of them; returning null leaves that disk out altogether (it has been told not to alert).
|
||||
*/
|
||||
export function disksFillingSoon(series: MetricSeries[], withinDays: number, alreadyAlertedAt: number): DiskForecast[] {
|
||||
export function disksFillingSoon(series: MetricSeries[], withinDays: number, alreadyAlertedAt: number | ((mount: string) => number | null)): DiskForecast[] {
|
||||
const out: DiskForecast[] = [];
|
||||
for (const s of series) {
|
||||
if (s.kind !== "disk" || !s.trend || s.latest === null) continue;
|
||||
const { perDay, fit, spanDays, daysToFull } = s.trend;
|
||||
if (daysToFull === null || daysToFull > withinDays) continue;
|
||||
if (spanDays < FORECAST_MIN_SPAN_DAYS || fit < FORECAST_MIN_FIT) continue;
|
||||
if (s.latest >= alreadyAlertedAt) continue;
|
||||
out.push({ mount: s.metric.slice("disk:".length), latest: s.latest, perDay, daysToFull });
|
||||
const mount = s.metric.slice("disk:".length);
|
||||
const limit = typeof alreadyAlertedAt === "function" ? alreadyAlertedAt(mount) : alreadyAlertedAt;
|
||||
if (limit === null || s.latest >= limit) continue;
|
||||
out.push({ mount, latest: s.latest, perDay, daysToFull });
|
||||
}
|
||||
return out.sort((a, b) => a.daysToFull - b.daysToFull);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user