2023-04-20 01:39:36 +02:00
|
|
|
---
|
|
|
|
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
|
2023-06-17 07:25:56 +02:00
|
|
|
repeat_interval: 24h
|
2023-04-20 01:39:36 +02:00
|
|
|
receiver: 'tg1'
|
|
|
|
routes:
|
|
|
|
- matchers:
|
|
|
|
- severity=warning
|
|
|
|
receiver: 'tg1'
|
|
|
|
|
|
|
|
- matchers:
|
|
|
|
- severity=critical
|
|
|
|
receiver: 'tg1'
|
|
|
|
|
|
|
|
receivers:
|
|
|
|
- name: tg1
|
|
|
|
telegram_configs:
|
2023-04-20 04:57:03 +02:00
|
|
|
- bot_token_file: '/etc/alertmanager/telegram-token/api_key'
|
2023-04-20 01:39:36 +02:00
|
|
|
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 }}
|
|
|
|
|