62 lines
1.5 KiB
YAML
62 lines
1.5 KiB
YAML
|
---
|
||
|
kind: ConfigMap
|
||
|
metadata:
|
||
|
labels:
|
||
|
app.kubernetes.io/instance: prometheus
|
||
|
app.kubernetes.io/managed-by: Helm
|
||
|
app.kubernetes.io/name: alertmanager
|
||
|
app.kubernetes.io/version: v0.25.0
|
||
|
helm.sh/chart: alertmanager-0.24.1
|
||
|
name: prometheus-alertmanager
|
||
|
namespace: prometheus
|
||
|
apiVersion: v1
|
||
|
data:
|
||
|
alertmanager.yml: |
|
||
|
global:
|
||
|
resolve_timeout: 5m
|
||
|
|
||
|
templates:
|
||
|
- '/etc/alertmanager/telegram.tmpl'
|
||
|
|
||
|
route:
|
||
|
group_by: ['alertname']
|
||
|
group_wait: 30s
|
||
|
group_interval: 30s
|
||
|
repeat_interval: 3h
|
||
|
receiver: 'tg1'
|
||
|
routes:
|
||
|
- matchers:
|
||
|
- severity=warning
|
||
|
receiver: 'tg1'
|
||
|
|
||
|
- matchers:
|
||
|
- severity=critical
|
||
|
receiver: 'tg1'
|
||
|
|
||
|
receivers:
|
||
|
- name: tg1
|
||
|
telegram_configs:
|
||
|
- bot_token_file: '/etc/alertmanager/telegram-token'
|
||
|
chat_id: -995270884
|
||
|
api_url: "https://api.telegram.org"
|
||
|
send_resolved: true
|
||
|
parse_mode: "HTML"
|
||
|
message: '{{ template "telegram.aaron" .}}'
|
||
|
|
||
|
inhibit_rules:
|
||
|
- source_matchers:
|
||
|
- severity = critical
|
||
|
target_matchers:
|
||
|
- severity = warning
|
||
|
equal: ['alertname', 'server', 'instance']
|
||
|
telegram.tmpl: |
|
||
|
{{ define "telegram.aaron" }}
|
||
|
{{ range .Alerts }}
|
||
|
{{ if eq .Status "firing"}}🔥 <b>{{ .Labels.alertname }}</b> 🔥{{ else }}✅ <b>{{ .Labels.alertname }}</b> ✅{{ end }}
|
||
|
<b> {{ .Annotations.summary }} </b>
|
||
|
|
||
|
{{ .Annotations.description }}
|
||
|
{{ end }}
|
||
|
{{ end }}
|
||
|
|