On a host with unattended-upgrades enabled, no successful run in
unattended_upgrades_stale_after_days (default 3, 0 disables) puts it in
update. The reason says which way it broke: still running but failing
("last succeeded 5d ago and is failing (last ran 6h ago); check
/var/log/unattended-upgrades/"), not running at all ("is
apt-daily-upgrade.timer enabled?"), or never succeeded. A host where it
hasn't completed its first run yet gets a note, and packages it keeps back
are noted. Hosts with it disabled or not installed, and agents before
0.8.0, are judged as before. The host page shows the state, both stamp
ages and the kept-back packages.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent now sends whether unattended-upgrades is enabled (package
installed, not just its leftover config, and APT::Periodic::Unattended-
Upgrade set and non-zero), the age of apt.systemd.daily's upgrade-stamp
(touched only when unattended-upgrade exits 0), the age of
unattended-upgrade's own stamp (written whenever a run gets far enough,
even if it then fails) and the packages it keeps back. Nothing reads them
yet. Agent 0.8.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Past its end of support a release gets no more security updates, so apt
offers nothing and the host showed ok indefinitely. The server now has a
table of when free security support ends for each release the agent
installs on (support.py): Debian's LTS end, and Ubuntu's end of standard
support plus end of ESM. Dates from Debian LTS and Ubuntu's release cycle
via endoflife.date; a test checks the table covers every release
agent/install.sh accepts.
The agent reports whether Ubuntu Pro is attached and esm-infra's status,
read from the pro client's world-readable status.json. A host past its
date goes to update; within os_eol_warn_days (default 90) of it, the row
gets a note. An Ubuntu host with ESM enabled isn't warned when standard
support ends, only before ESM does. The host page shows the dates.
Agent 0.7.0; older agents don't report ESM and count as having none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A full /boot makes the next kernel's postinst fail: apt is left half-done
and the host quietly stays on its old kernel, which kernelwatch only
noticed indirectly, if at all. The agent now reports the size and free
space of the filesystem holding /boot (df) and the packages dpkg didn't
finish installing (half-installed, unpacked, half-configured, trigger
states or reinst-required, as dpkg --audit counts them).
The server puts a host in update when /boot has less than
boot_min_free_mb (default 200, 0 disables) free, or any package is
unfinished, with the fix in the reason ("run dpkg --configure -a"). The
host page shows both. Agents before 0.6.0 send neither field and are
judged as before. Agent 0.6.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kernelwatch-backup.service still had PrivateNetwork=yes and
RestrictAddressFamilies=AF_UNIX from before scheduled-backup pinged
backup_heartbeat_url. Every nightly ping failed DNS inside the sandbox
("heartbeat request failed (URLError)"); the backup itself succeeded, so
the only symptom was the heartbeat monitor going down after a day.
Allow AF_INET/AF_INET6 like the alerts unit, and add a test that every
unit running a command that sends requests (check-alerts,
scheduled-backup, notify-backup-failure) keeps network access.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The agent ran `apt-get -s dist-upgrade 2>/dev/null || true`, so when apt
failed (unmet dependencies, a broken sources entry, a damaged package cache)
the empty output counted as zero updates and the host could show ok while
nothing could be installed. The agent now keeps apt's exit status and stderr,
reports apt_simulation_ok and the first "E:" line as apt_simulation_error,
and sends the update counts as null. The server puts such a host in update
with "apt can't work out pending updates: ...", and the host page shows the
result. Agents before 0.5.0 don't send the field and are judged as before.
Also show "–" rather than "None" for an unknown count in a host's history,
and stop hard-coding the agent version in the status CLI tests. Agent 0.5.0.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The alert check now also notifies, once per problem, when a host's Livepatch has
been unhealthy for livepatch_alert_after_hours (default 6), or when a host that
used to report Livepatch no longer does (a dead daemon leaves the agent with
nothing to send). A livepatch_alerts table records which hosts have reported
Livepatch, when the current problem began and whether it was notified, so hosts
without Livepatch never alert and restarts do not repeat messages. Stale hosts
are skipped.
livepatch_problem() is now the single test for unhealthy, shared with the cover
rule for pending reboots, and names the check state when that is the problem.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Every relative link must point at an existing file and, when it has a #anchor,
at a real heading (slugged the way Gitea does); every docs page must be linked
from the README and link back to it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
'above', 'below' and 'as above' pointed at sections that are now on other
pages, so they become links; server/install.sh's pointer to the README now
names docs/reverse-proxy.md; server.md gains the next steps that used to be
the following README sections.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The README keeps the intro, diagram, status table, a three-step quick start and
an index of the docs/ pages; everything else lives in docs/.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Content is moved verbatim (checked line by line against the old README). Each
page gets a title and a link back to the README; H3 sections that become pages
of their own are promoted to H2. The README itself is trimmed next.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Prints the fleet like the dashboard, worst hosts first, from the same
evaluate() call, so the CLI and the dashboard cannot disagree. --json gives
generated_at, whole-fleet counts and a stable per-host object with no secrets;
--host and --level (repeatable) trim the host list. No network surface.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
heartbeat_url is pinged after every alert check that sent its notifications
without failures, and backup_heartbeat_url after every successful nightly
backup, so an external monitor (healthchecks.io, Uptime Kuma) notices when the
alert timer or the backup stops running. A failing heartbeat is logged without
the URL and never fails the work it reports on. kernelwatch test-heartbeat
pings each configured URL once.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kernelwatch-backup.service gets OnFailure=kernelwatch-backup-failed.service,
which runs notify-backup-failure, so timeouts, OOM kills and crashes are
reported as well as handled errors. The installer ships the new unit, and tests
check that every OnFailure= target is a real unit.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Sends a high-priority ntfy message that the nightly backup failed, naming the
newest backup still on disk. It exits 1 if the message can't be delivered and 0
(with a note on stderr) when ntfy isn't configured.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kernelwatch scheduled-backup writes kernelwatch-YYYY-MM-DD.db into backup_dir
and prunes dated copies backup_keep_days or older, only after the new backup
succeeded and only files with exactly that name. kernelwatch-backup.timer runs
it at about 03:30 as the unprivileged service user with no network, and
server/install.sh enables it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
27 tests run the real scripts with systemctl, apt-get, useradd and friends
stubbed: fresh installs, upgrades keeping config and token, token sources,
REPORT_HOSTNAME handling, apt-update marker, private CA, needrestart, failed
first report, OS warnings, argument errors, and the server's user creation,
config preservation and interrupted-upgrade recovery. Guards that every unit
and script is installed and that deploy.sh ships every file the agent
installer uses.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
KERNELWATCH_ROOT prefixes every path agent/install.sh and server/install.sh
read or write and skips their root check. Unset (as in production) every path
is unchanged; the only edits are quoting and mkdir -p for system directories
that already exist.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
REPORT_HOSTNAME in agent.conf replaces hostname -f in the report, for hosts
registered under a label that differs from their real hostname (otherwise the
dashboard notes a mismatch forever). install.sh --report-hostname NAME sets it,
--default-report-hostname clears it, and re-running with --server (register,
rotate) keeps it. Agent 0.4.1.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
kernelwatch-livepatch.service runs canonical-livepatch as root with no
network and a read-only filesystem, and a small python3 helper keeps the
running kernel's state, check state, support, end-of-support date and fix
count in /run/kernelwatch/livepatch. The agent (0.4.0) reads that file the
way it reads needrestart's and never runs the snap itself.
NoNewPrivileges=yes can't be used: snap-confine fails under it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
New livepatch_* report fields. When Livepatch is healthy (applied or
nothing-to-apply, checked, supported) and the kernel's support end date is
more than 14 days away, a pending kernel reboot, or a reboot-required file
caused only by linux-* packages, becomes a note instead of the reboot status.
Anything else about Livepatch gives no cover and is noted.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A note on the dashboard row and host page, not a status change, so a token
copied to the wrong machine is visible. Only the first DNS label is compared,
ignoring case, since registered names are usually hostname -s and the agent
reports hostname -f.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Reports arriving sooner than report_min_interval_seconds (default 30) after
the host's previous one are refused with 429 and a Retry-After header. The
check shares the insert's transaction so concurrent requests can't bypass it.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Uses SQLite's online backup API, so it is consistent while the server is
writing in WAL mode. Writes mode 0600 via a temp file and rename, and
refuses to overwrite the live database.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>