Skip to content

Instantly share code, notes, and snippets.

@fhemberger
Created June 30, 2025 07:51
Show Gist options
  • Save fhemberger/065abc6bf4a4ce1f3dfe166536340948 to your computer and use it in GitHub Desktop.
Save fhemberger/065abc6bf4a4ce1f3dfe166536340948 to your computer and use it in GitHub Desktop.
Example config for alertmanager-ntfy with custom templating
http:
addr: :8000
auth:
username: "alertmanager"
password: "verysecure"
ntfy:
baseurl: https://ntfy.sh
auth:
username: "admin"
password: "verysecure"
# Token authentication is also available
# token: <token>
notification:
# The topic can either be a hardcoded string or a gval expression that evaluates to a string
topic: alertmanager
# Priority reference: https://docs.ntfy.sh/publish/#message-priority
# Can either be a hardcoded string or a gval expression that evaluates to a string
priority: |
status == "firing" ? (labels["severity"] == "critical" ? "high" : "default") : "low"
tags:
# Tags with no condition are always included
# Emoji shortcode reference: https://docs.ntfy.sh/emojis/
- tag: "+1"
condition: status == "resolved"
- tag: rotating_light
condition: status == "firing" && labels["severity"] == "critical"
- tag: warning
condition: status == "firing" && labels["severity"] != "critical"
templates:
title: |
{{ if eq .Status "resolved" }}Resolved: {{ end }}{{ index .Annotations "summary" }}
description: |
{{ index .Annotations "description" }}
headers:
X-Actions: |
view, View, {{ .GeneratorURL }};
view, Silence, https://alertmanager.example.com/#/silences/new?filter=
{{- `{` -}}
{{- $first := true -}}
{{- range $key, $value := .Labels -}}
{{- if $first }}{{ $first = false }}{{ else }}{{ urlquery "," }}{{ end -}}
{{ $key }}%3D%22{{ $value }}%22
{{- end -}}
{{- `}` -}}
&comment=created via ntfy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment