Alert when Livepatch is broken or has stopped reporting
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>
This commit is contained in:
1 parent
203c729e14
commit
650806bfce
7 files changed
+346
-6
No files matched your search
@@ -57,6 +57,9 @@ class Config:
|
||||
backup_heartbeat_url: str = ""
|
||||
# Notify when a host has needed a reboot or updates for this long; 0 disables.
|
||||
status_alert_after_hours: float = 24.0
|
||||
# Notify when Livepatch has been unhealthy, or a host that used to report it has
|
||||
# stopped, for this long; 0 disables.
|
||||
livepatch_alert_after_hours: float = 6.0
|
||||
|
||||
|
||||
def load(path: str | None = None) -> Config:
|
||||
@@ -108,6 +111,8 @@ def load(path: str | None = None) -> Config:
|
||||
valid = False
|
||||
if not valid:
|
||||
raise SystemExit(f"{path}: {key} must be an HTTP(S) URL without spaces or a fragment")
|
||||
if not math.isfinite(cfg.livepatch_alert_after_hours) or cfg.livepatch_alert_after_hours < 0:
|
||||
raise SystemExit(f"{path}: livepatch_alert_after_hours must be zero or positive and finite")
|
||||
if any(ord(c) < 32 or ord(c) == 127 for c in cfg.ntfy_url + cfg.ntfy_token):
|
||||
raise SystemExit(f"{path}: ntfy settings must not contain control characters")
|
||||
if cfg.ntfy_url:
|
||||
|
||||
Reference in new issue
Block a user