Skip to content

feat(sensitive): alerts on the phone as a title and a line (#136) - #716

Merged
Gerrrt merged 1 commit into
mainfrom
gerrrt/ntfy-alert-template-136
Sep 29, 2026
Merged

Gerrrt merged 1 commit into
mainfrom
gerrrt/ntfy-alert-template-136

Conversation

@Gerrrt

@Gerrrt Gerrrt commented Sep 28, 2026

Copy link
Copy Markdown
Owner

What changed

A custom ntfy template, stacks/sensitive/ntfy/templates/homelab.yml, mounted at ntfy's default template-dir. Alertmanager payloads render like this, measured on the pinned image:

P5 | 🔴 ntfy is not reachable at https://ntfy.matrix.elysium/v1/health
Probed by dns and got no successful response for five minutes.
📍 trinity

P2 | ✅ Resolved: UPS is on battery
Mains lost at the rack.
📍 mjolnir

P3 | 🟠 3 × SnmpTargetUnreachable
• SNMP target pfsense unreachable
• SNMP target ups unreachable
• SNMP target ilo unreachable

Priority follows severity:

  • Critical is 5: Android's loud channel, and time-sensitive on iOS.
  • Warning is 3.
  • Resolved alerts and the daily Watchdog are 2.

Why

Every rule's description is a paragraph written for a keyboard, and the phones received it whole. The ntfy.sh copies received the raw webhook JSON.

Blast radius

  • trinity: one new read-only directory mount into sensitive-ntfy. make up STACK=sensitive recreates the container.

  • prometheus: secrets edit needed. Nothing changes on the phones until it's done.

    • The three in-house ALERTMANAGER_*_WEBHOOK_URL values change ?template=alertmanager to ?template=homelab.
    • The two *_EXTERNAL_URL values gain ?template=alertmanager. ntfy.sh can't load our template, and the built-in beats raw JSON.
    • url_file is read at notify time, so this takes effect on the next notification with no restart.
  • If the template ever fails to render, ntfy rejects that publish. AlertmanagerNotificationsFailing then fires through the ntfy.sh copy.

  • No change to network segmentation or firewall rules

  • No new port published to a VLAN that could not already reach the service

  • No credential added outside secrets/*.sops.yaml

Verification

  • Payload shapes: six rendered through ntfy:v2.28.0 with the template mounted read-only and all capabilities dropped: critical, warning, resolved, a group of three, Watchdog, and one with no annotations. The output is above.

  • Real rules: the first-sentence rule was checked against all 102 alerting rules' descriptions. Four run past 200 characters and are trimmed with an ellipsis. Those with no description show severity · category instead of ntfy's filler text, "triggered".

  • Checks: make validate passes, and yamllint is clean.

  • make validate passes

  • Deployed to the lab and confirmed working: after merge, make up STACK=sensitive on trinity and the URL edit on prometheus, then step 8's synthetic page shows it on the phones

  • Docs updated: stack README, secrets template, alertmanager.yaml comment, runbook

Refs #136

🤖 Generated with Claude Code

Every rule's description is a paragraph written for a keyboard, and the
phones were getting it whole. On the ntfy.sh topics they got the raw
webhook JSON.

stacks/sensitive/ntfy/templates/homelab.yml renders each payload as:
  - Title: a severity marker and the summary. A group shows the count
    and the alert name.
  - Message: the description's first sentence (at most 200 characters)
    and the host, or one line per summary for a group.
  - Priority: critical 5, warning 3, resolved and the rest 2.

Checked against six payload shapes on the pinned image under its
hardening, and against every rule's description: four are trimmed, and
those with none show severity and category rather than ntfy's
"triggered".

The in-house URLs move to ?template=homelab. The ntfy.sh copies take
?template=alertmanager, the built-in, since ntfy.sh cannot load ours.
Both are SOPS values on prometheus, so this needs a secrets edit there.

Refs #136

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Gerrrt
Gerrrt merged commit 5c2a7b1 into main Sep 29, 2026
7 checks passed
@Gerrrt
Gerrrt deleted the gerrrt/ntfy-alert-template-136 branch September 29, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant