add alertmanager config

This commit is contained in:
Aaron Riedel 2023-04-20 01:39:36 +02:00
parent 1230d5c05e
commit cca32125a4
Signed by: aaron
GPG key ID: 643004654D40D577
3 changed files with 73 additions and 0 deletions

View file

@ -130,6 +130,11 @@ spec:
targetRevision: 20.2.0 targetRevision: 20.2.0
helm: helm:
releaseName: prometheus releaseName: prometheus
valueFiles:
- $values/prometheus/values.yaml
- repoURL: https://git.ar21.de/yolokube/core-deployments.git
targetRevision: HEAD
ref: values
- repoURL: https://git.ar21.de/yolokube/core-deployments.git - repoURL: https://git.ar21.de/yolokube/core-deployments.git
targetRevision: HEAD targetRevision: HEAD
path: prometheus path: prometheus

View file

@ -0,0 +1,61 @@
---
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 }}

7
prometheus/values.yaml Normal file
View file

@ -0,0 +1,7 @@
alertmanager:
extraSecretMounts:
- name: telegram-api
mountPath: /etc/alertmanager/telegram-token
subPath: ""
secretName: telegram-api
readOnly: true