Host health from the Linux agent, agent self-update, and disk forecast in /metrics

- Linux agent v4: failed systemd services, SMART disk health, ZFS pool state, pacman updates;
  SMART/ZFS and self-update run in the ExecStartPre=-+ step outside the sandbox
- Server: hosts' health stored (servers.host_health, migration 0029), alerts under a new
  "Failing services" kind plus disk/ZFS alerts, Host health card, Prometheus series
- Agent self-update (Linux v4, Windows v3): admin switch on the Servers page, checksum-verified
  download, atomic replace; GET /api/agent/report/update
- homelab_server_disk_days_to_full in /metrics
- Tests (server, real PowerShell against a fake server) and docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 00:54:24 +02:00
1 parent 540ab704b7
commit 5dc6cea69c
38 files changed
+3884 -73

No files matched your search

+7 -5
View File
@@ -88,13 +88,15 @@ Description=Report scheduled tasks to Homelab Manager
Type=oneshot
EnvironmentFile=$CONFIG_DIR/homelab-manager-agent.env
ExecStart=$INSTALL_DIR/homelab-manager-agent.sh
# Asking dnf or zypper what is waiting still writes to /var and /run, which the sandbox below makes read-only, so this one step runs
# first and outside it (the + does that; the - lets the report go ahead whatever happens). It only reads what the package manager
# knows and leaves the answer in the unit's private directory, which goes away when the run ends.
ExecStartPre=-+$INSTALL_DIR/homelab-manager-agent.sh --prepare-updates
# A few things can't be done inside the sandbox below, so one step runs first and outside it (the + does that; the - lets the report go
# ahead whatever happens): asking dnf or zypper what is waiting (they write to /var and /run even when only asked), reading disk health and
# ZFS pool state (the sandbox closes the devices), and, only if an administrator has switched it on in Homelab Manager, replacing the agent
# script with a newer one (the sandbox keeps /usr read-only). It leaves its answers in the unit's private directory, which goes away when
# the run ends; the one thing kept between runs is the last SMART reading, in /var/lib/homelab-manager-agent.
ExecStartPre=-+$INSTALL_DIR/homelab-manager-agent.sh --prepare
RuntimeDirectory=homelab-manager-agent
RuntimeDirectoryMode=0700
TimeoutStartSec=420
TimeoutStartSec=600
# The agent only reads (crontabs, timers, /proc, listening sockets) and makes one HTTPS request, but it runs as root. These
# keep a bug in it, or in anything it parses, from being able to change the system. It still sees every process, which is
# how it names the program behind each listening port. Directives an older systemd doesn't know are ignored.