Skip to content

Commit e6c3ff8

Browse files
committed
Update default alert message template
1 parent 488f9c6 commit e6c3ff8

File tree

2 files changed

+35
-23
lines changed

2 files changed

+35
-23
lines changed

Diff for: docker-compose.yml

+23-23
Original file line numberDiff line numberDiff line change
@@ -55,25 +55,6 @@ services:
5555
networks:
5656
- cosmos-monitoring
5757

58-
alertmanager:
59-
image: prom/alertmanager:latest
60-
container_name: alertmanager
61-
networks:
62-
- cosmos-monitoring
63-
ports:
64-
- 9093:9093
65-
volumes:
66-
- type: bind
67-
source: ./prometheus/alert_manager
68-
target: /etc/alertmanager
69-
read_only: true
70-
command: [
71-
'--config.file=/etc/alertmanager/alertmanager.yml',
72-
'--log.level=debug',
73-
]
74-
hostname: 'alertmanager'
75-
restart: always
76-
7758
alerta_db:
7859
image: postgres:11
7960
container_name: alerta_db
@@ -109,17 +90,35 @@ services:
10990
- PLUGINS=reject,blackout
11091
hostname: 'alerta'
11192
restart: always
112-
93+
94+
alertmanager:
95+
image: prom/alertmanager:latest
96+
container_name: alertmanager
97+
networks:
98+
- cosmos-monitoring
99+
ports:
100+
- 9093:9093
101+
volumes:
102+
- type: bind
103+
source: ./prometheus/alert_manager
104+
target: /etc/alertmanager
105+
read_only: true
106+
command: [
107+
'--config.file=/etc/alertmanager/alertmanager.yml',
108+
'--log.level=debug',
109+
]
110+
hostname: 'alertmanager'
111+
restart: always
112+
113113
alertmanager-bot:
114114
container_name: alertmanager-bot
115115
command:
116116
- '--alertmanager.url=http://alertmanager:9093'
117117
- '--log.level=info'
118118
- '--store=bolt'
119119
- '--bolt.path=/data/bot.db'
120-
environment:
121-
TELEGRAM_ADMIN: ${TELEGRAM_ADMIN}
122-
TELEGRAM_TOKEN: ${TELEGRAM_TOKEN}
120+
- "--telegram.admin=${TELEGRAM_ADMIN}"
121+
- "--telegram.token=${TELEGRAM_TOKEN}"
123122
image: metalmatze/alertmanager-bot:0.4.3
124123
networks:
125124
- cosmos-monitoring
@@ -129,3 +128,4 @@ services:
129128
restart: always
130129
volumes:
131130
- ./data:/data
131+
- ./prometheus/alert_manager/templates:/templates

Diff for: prometheus/alert_manager/templates/default.tmpl

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{ define "telegram.default" }}
2+
{{ range .Alerts }}
3+
{{ if eq .Status "firing"}}🔥 <b>{{ .Labels.alertname }}</b> 🔥{{ else }}✅ <b>{{ .Labels.alertname }}</b> ✅{{ end }}
4+
<b>Labels:</b>{{ range $key, $value := .Labels }}{{ if ne $key "alertname" }}
5+
{{ $key }}: {{ $value }}{{ end }}{{ end }}
6+
<b>Annotations:</b>{{ range $key, $value := .Annotations }}
7+
{{ $key }}: {{ $value }}{{ end }}{{ if eq .Status "firing"}}
8+
<b>Duration:</b> {{ since .StartsAt }}{{ else }}
9+
<b>Duration:</b> {{ duration .StartsAt .EndsAt }}
10+
<b>Ended:</b> {{ .EndsAt | since }}{{ end }}
11+
{{ end }}
12+
{{ end }}

0 commit comments

Comments
 (0)