Notification routing rules, per-browser push wishes, escalation of unacknowledged alerts

- Routing: rules pick channels by kind, severity and server tags (first match wins, none = nobody); mixed batches split per route; recoveries follow their alert; quiet-hours digest keeps each notification's audience
- Push: each subscribed browser can ask for a minimum severity and some kinds
- Escalation: up to three timed steps re-notify alerts nobody has acknowledged, through chosen channels and an optional extra email; an acknowledgement stops them
- Fix ntfy: titles with an em dash made every ntfy send fail (header not Latin-1); now RFC 2047 encoded

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 19:44:45 +02:00
1 parent 9caa414829
commit 43fc5e0272
21 files changed
+4769 -55

No files matched your search

+35 -4
View File
@@ -3,15 +3,15 @@
Every notification in Homelab Manager is sent through the same pipe
(`server/src/services/notify.ts`) to whichever channels are enabled under
**Settings → Notifications**: Gotify, ntfy, SMTP (email), a generic
JSON webhook, and push to phones and browsers. All five fire for every notification below — there's no
per-event channel routing, only a per-event on/off toggle and, for the
JSON webhook, and push to phones and browsers. All five fire for every notification below unless a
**routing rule** (see *Who hears what* below) says otherwise; each event also has its on/off toggle and, for the
daily ones, one shared time/timezone.
The settings page has three tabs, with one Save button for all of them (it
The settings page has four tabs, with one Save button for all of them (it
shows "Unsaved changes" until you save, and the browser asks before the page
is closed with changes unsaved): **Channels** (the five channels, each a row
you open to fill in and send a test), **What to send** (the event toggles
grouped by topic, each group's thresholds beside its switches) and **When**
grouped by topic, each group's thresholds beside its switches), **Who hears what** (routing rules and escalation) and **When**
(the time zone, the daily reminder time, quiet hours and the weekly digest).
The address keeps the tab, e.g. `/settings/notifications?tab=when`.
@@ -34,6 +34,36 @@ it:
Where a trigger has a configurable threshold, that's noted in its row
below; several are fixed and can't be changed from the UI.
## Who hears what
Under **Settings → Notifications → Who hears what**.
**Routing rules.** By default every notification goes to every channel that is switched on. A rule narrows that for what it matches, on any of:
the **kind** of problem (server down, disk and storage, failing services, backups, updates, expiry, automation, integration failing …), how
**bad** it is (warning or worse, critical only) and the **tags** of the server it is about (any of them). **The first rule that matches decides** which
channels get it — put the specific rules first — and a rule with no channels tells nobody (the Alerts page still shows the problem, and webhooks for
events still fire). A notification no rule matches goes to every channel that is on, as before. Rules can be switched off and reordered.
- A message that holds problems for different routes is split: a disk warning can go to ntfy while the server outage in the same check goes to
everything, as two messages. When all of them take the same route it is one message, as ever.
- A recovery follows the route its alert took (the health check remembers how bad each problem was).
- What a rule can see: health and automation problems carry a kind, a severity and (for servers) the server; secret, domain and Tailscale expiry, backup
checks, Docker image updates, update runs and integration failures carry a kind and a severity. DNS changes, the weekly digest and similar carry
neither, so only rules that ask about nothing in particular match them.
- Notifications held for quiet hours keep who they were for: the digest at the end goes only to the channels their rule picked.
**Each browser's own wishes.** Under *Phone and browser*, every subscribed browser can say it only wants warnings or worse, or only critical alerts,
and only some kinds of alert — a phone for the critical things, a desktop for everything. It applies after routing: a rule that sends something to
*Phone and browser* still doesn't reach a browser that turned that kind down. A notification that says nothing about its kind or severity reaches all.
**Escalation.** When an alert has been raised for a while and **nobody has acknowledged it**, it is told again, in up to three steps — for example *after
30 minutes: push; after 2 hours: email the neighbour who holds the key*. Each step names its time, the least severity it applies to, the channels to use
(chosen freely — routing rules don't apply to escalations), an optional extra email address to tell as well (sent through the email channel's server) and
whether to send during quiet hours (otherwise it waits for them to end like any other). Every step is sent once per alert; an acknowledgement stops the
rest, and the alert starts over if it goes away and comes back. Problems under maintenance, held back because something they depend on is down, or only
informational never escalate. It is looked at every five minutes, so a step can arrive a few minutes after its time. Every escalation is written in the audit
log (category *alert*, action *escalate*).
## Push to a phone or browser
The fifth channel, **Phone and browser**, sends the same messages as the others to browsers that have asked for them — a phone with
@@ -48,6 +78,7 @@ with a button to send a test and one to remove each.
it is needed (RFC 8292, "VAPID"), then handed to the browser's own push service — Google's, Mozilla's or Apple's — which delivers
it. The push service sees that a message is being sent and its size, not what it says. The address of each browser's push
service is checked before use: https only, and never an address on a private network.
- **Browsers' own wishes** (a minimum severity, which kinds) are set per browser under the channel's row.
- **Quiet hours** hold push messages like every other channel, and each event's on/off toggle applies. A tap on a notification opens
the Alerts page.
- **A browser that has gone** (the site's permission was removed, the app uninstalled) is dropped automatically when its push