From a11a43c757879f3437cc3f8e8ae69c2ead1ac861 Mon Sep 17 00:00:00 2001 From: Song Meo Date: Thu, 15 Sep 2022 21:12:33 +0300 Subject: [PATCH] alertmanager: email config --- prometheus-operator/alertmanager-config.yml | 80 +++++++++++++++++++++ prometheus-operator/application.yml | 3 + 2 files changed, 83 insertions(+) create mode 100644 prometheus-operator/alertmanager-config.yml diff --git a/prometheus-operator/alertmanager-config.yml b/prometheus-operator/alertmanager-config.yml new file mode 100644 index 0000000..d2df166 --- /dev/null +++ b/prometheus-operator/alertmanager-config.yml @@ -0,0 +1,80 @@ +apiVersion: monitoring.coreos.com/v1alpha1 +kind: AlertmanagerConfig +metadata: + name: email + labels: + alertmanagerConfig: email +spec: + route: + group_by: [email] + receiver: test_router + # When the first notification was sent, wait 'group_interval' to send a batch + # of new alerts that started firing for that group. + group_interval: 1s + # If an alert has successfully been sent, wait 'repeat_interval' to + # resend them. + repeat_interval: 24h + routes: + - match: + severity: critical + group_wait: 1s + - match: + severity: error + group_wait: 30m + - match: + severity: warning + group_wait: 4h + - match: + severity: info + group_wait: 24h + receivers: + - name: email_router + email_configs: + # - to: "{{ .GroupLabels.email }}" + - to: 'Lauri Võsandi ' + from: 'Alerting ' + smarthost: mail.k-space.ee:465 + require_tls: false + auth_username: 'alerting' + auth_password: '5A8m0Y9yC4NcFXztmwMb' + headers: + subject: "You have {{ .Alerts.Firing | len }} firing alerts at {{ .CommonLabels.severity }} level" + html: | + Hi {{ .GroupLabels.email }}, +

+ You have the following firing alerts: +

    + {{ range .Alerts }} +
  • {{.Labels.alertname}} on {{ .Labels.instance }}
  • + {{ end }} +
+

+ For more info see Prometheus alerts page. +

+ To silence alerts visit Alert manager page. + - name: test_router + email_configs: + # - to: "{{ .GroupLabels.email }}" + - to: 'Song Meo ' + from: 'Alerting ' + smarthost: mail.k-space.ee:465 + require_tls: false + auth_username: 'alerting' + auth_password: + name: email-config + key: auth_password + headers: + subject: "[test] You have {{ .Alerts.Firing | len }} firing alerts at {{ .CommonLabels.severity }} level" + html: | + Hi, +

+ You have the following firing alerts: +

    + {{ range .Alerts }} +
  • {{.Labels.alertname}} on {{ .Labels.instance }}
  • + {{ end }} +
+

+ For more info see Prometheus alerts page. +

+ To silence alerts visit Alert manager page. diff --git a/prometheus-operator/application.yml b/prometheus-operator/application.yml index 0fe2131..546e3e1 100644 --- a/prometheus-operator/application.yml +++ b/prometheus-operator/application.yml @@ -15,6 +15,9 @@ kind: Alertmanager metadata: name: alertmanager spec: + alertmanagerConfigSelector: + matchLabels: + alertmanagerConfig: email nodeSelector: dedicated: monitoring tolerations: