feat(alerts): add container health alerts with log excerpt on notifications (#2225)

Add a new "ContainerHealth" alert type that fires when a Docker container's
health check reports unhealthy, and resolves when it recovers. This mirrors
the existing Status (up/down) alert pattern: an alert can be armed per system
and honors the "min minutes" delay before firing.

When the alert fires, the notification (email and any configured webhook,
including Discord via shoutrrr) includes a log excerpt fetched live from the
agent for up to 2 of the unhealthy containers, prioritizing lines containing
"error" or "fatal" (falling back to the log tail if none match), capped to
keep the message well under Discord's size limit.

---------

Co-authored-by: hank <hank@henrygd.me>
This commit is contained in:
Michał Mleczko
2026-09-02 18:46:23 +02:00
committed by GitHub
parent b1895247ba
commit 5969d36856
44 changed files with 1245 additions and 16 deletions

View File

@@ -419,6 +419,14 @@ msgstr "Conflicts"
msgid "Connection is down"
msgstr "Connection is down"
#: src/lib/alerts.ts
msgid "Container"
msgstr "Container"
#: src/lib/alerts.ts
msgid "Container Health"
msgstr "Container Health"
#: src/components/routes/system.tsx
msgid "Containers"
msgstr "Containers"
@@ -1744,6 +1752,10 @@ msgstr "Triggers when 15 minute load average exceeds a threshold"
msgid "Triggers when 5 minute load average exceeds a threshold"
msgstr "Triggers when 5 minute load average exceeds a threshold"
#: src/lib/alerts.ts
msgid "Triggers when a Docker container's health check reports unhealthy"
msgstr "Triggers when a Docker container's health check reports unhealthy"
#: src/lib/alerts.ts
msgid "Triggers when any sensor exceeds a threshold"
msgstr "Triggers when any sensor exceeds a threshold"
@@ -1790,6 +1802,10 @@ msgstr "Triggers when usage of any disk exceeds a threshold"
msgid "Type"
msgstr "Type"
#: src/lib/alerts.ts
msgid "Unhealthy"
msgstr "Unhealthy"
#: src/components/systemd-table/systemd-table.tsx
msgid "Unit file"
msgstr "Unit file"