Document the heartbeat monitor setup
CI / tests (Python 3.10) (pull_request) Successful in 24s
CI / tests (Python 3.11) (pull_request) Successful in 24s
CI / tests (Python 3.12) (pull_request) Successful in 24s
CI / tests (Python 3.13) (pull_request) Successful in 24s
CI / lint (pull_request) Successful in 4s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
patrickandClaude Sonnet 5.5 committed 2026-10-30 11:32:15 -04:00
1 parent 60b8c6bff7
commit 55a9766418
2 files changed
+47

No files matched your search

+41
View File
@@ -453,6 +453,46 @@ accept the POST without a browser login or redirect. The topic and token stay
in the server config (root-owned, readable by the `kernelwatch` service group).
Agents need no changes.
## Heartbeat: is kernelwatch itself running?
Every alert above depends on `kernelwatch-alerts.timer` running on the dashboard
host. If that host is down, or the timer breaks, nothing tells you. A heartbeat
fixes this: kernelwatch pings an external monitor, and the monitor alerts when the
pings **stop**. [healthchecks.io](https://healthchecks.io) has a free tier;
Uptime Kuma's push monitors work the same way.
1. In the monitor, create two checks and copy their ping URLs:
- **alerts**: period 5 minutes, grace 20 minutes.
- **backup**: period 1 day, grace a few hours (the timer fires about 03:30 and
can be up to 30 minutes late).
2. Add the URLs to `/etc/kernelwatch/server.toml` (no restart needed for the
alert check or the backup; they read it on every run):
```toml
heartbeat_url = "https://hc-ping.com/<uuid>"
backup_heartbeat_url = "https://hc-ping.com/<other-uuid>"
```
3. Check both: `sudo kernelwatch test-heartbeat` pings each configured URL once.
What counts as a heartbeat:
- `heartbeat_url` is pinged at the end of every alert check (every five minutes)
that sent all its notifications. If ntfy delivery is failing, the ping is
skipped on purpose, so the monitor also notices a broken alert pipeline. It's
pinged even with no `ntfy_url`, since the timer is still alive.
- `backup_heartbeat_url` is pinged after each successful nightly backup, so a
timer that never ran, or a backup that failed, shows up as a missing ping.
A manual `kernelwatch backup` doesn't ping.
- A heartbeat that can't be delivered is logged (status code or error type, never
the URL) and never fails the check or the backup.
The pings leave from the dashboard host, so a dead host is exactly what stops
them. Set the monitor to notify you some way that doesn't depend on that host:
email, the monitor's own app, or ntfy.sh. Not a ntfy server running behind it.
The URLs are secrets (whoever has one can fake a heartbeat), so keep
`server.toml` readable by root and the `kernelwatch` group only.
## Server admin commands
```
@@ -468,6 +508,7 @@ sudo kernelwatch scheduled-backup dated copy in backup_dir, then prune old on
sudo kernelwatch notify-backup-failure send the failed-backup notification now (also runs on failure)
sudo kernelwatch check-alerts check for stale, recovered, reboot and update alerts now
sudo kernelwatch test-alert send a test notification to the configured ntfy topic
sudo kernelwatch test-heartbeat ping the configured heartbeat URLs once and report
```
## Backups