add alertmanager config
This commit is contained in:
parent
1230d5c05e
commit
cca32125a4
3 changed files with 73 additions and 0 deletions
|
@ -130,6 +130,11 @@ spec:
|
|||
targetRevision: 20.2.0
|
||||
helm:
|
||||
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
|
||||
targetRevision: HEAD
|
||||
path: prometheus
|
||||
|
|
61
prometheus/alertmanager-config.yaml
Normal file
61
prometheus/alertmanager-config.yaml
Normal 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
7
prometheus/values.yaml
Normal file
|
@ -0,0 +1,7 @@
|
|||
alertmanager:
|
||||
extraSecretMounts:
|
||||
- name: telegram-api
|
||||
mountPath: /etc/alertmanager/telegram-token
|
||||
subPath: ""
|
||||
secretName: telegram-api
|
||||
readOnly: true
|
Loading…
Reference in a new issue