init
This commit is contained in:
commit
1ac93ba11b
16 changed files with 17834 additions and 0 deletions
17
conf/alertmanager/alertmanager.tmpl
Normal file
17
conf/alertmanager/alertmanager.tmpl
Normal file
|
@ -0,0 +1,17 @@
|
|||
global:
|
||||
templates:
|
||||
- /etc/alertmanager/templates/*.tmpl
|
||||
route:
|
||||
group_wait: 10s
|
||||
group_interval: 30s
|
||||
repeat_interval: 30m
|
||||
group_by: [alertname, instance]
|
||||
receiver: telegram
|
||||
receivers:
|
||||
- name: telegram
|
||||
telegram_configs:
|
||||
- bot_token: BOT_TOKEN
|
||||
chat_id: CHAT_ID
|
||||
api_url: https://api.telegram.org
|
||||
parse_mode: 'HTML'
|
||||
message: '{{ template "telegram.custom.message" .}}'
|
11
conf/alertmanager/templates/telegram.tmpl
Normal file
11
conf/alertmanager/templates/telegram.tmpl
Normal file
|
@ -0,0 +1,11 @@
|
|||
{{ define "telegram.custom.message" }}
|
||||
{{ range .Alerts }}
|
||||
{{ if eq .Status "firing"}}🔥<b>{{ .Labels.alertname }}</b>🔥{{ else }}👌<b>{{ .Labels.alertname }}</b>👌{{ end }}
|
||||
<b>Labels:</b>{{ range $key, $value := .Labels }}{{ if ne $key "alertname" }}
|
||||
- {{ $key }}: {{ $value }}{{ end }}{{ end }}
|
||||
<b>Annotations:</b>{{ range $key, $value := .Annotations }}
|
||||
- {{ $key }}: {{ reReplaceAll "(?s)LABELS = (.*)" "" $value }}{{ end }}
|
||||
<b>Start:</b> {{ .StartsAt }}{{ if eq .Status "resolved"}}
|
||||
<b>Ended:</b> {{ .EndsAt }}{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue