alertmanager: email config

This commit is contained in:
Song Meo 2022-09-15 21:12:33 +03:00
parent 6e0e7f4349
commit a11a43c757
2 changed files with 83 additions and 0 deletions

View File

@ -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 <lauri@k-space.ee>'
from: 'Alerting <alerting@k-space.ee>'
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 }},
<p>
You have the following firing alerts:
<ul>
{{ range .Alerts }}
<li>{{.Labels.alertname}} on {{ .Labels.instance }}</li>
{{ end }}
</ul>
</p>
For more info see <a href="https://prom.k-space.ee/alerts">Prometheus alerts page</a>.
<br><br>
To silence alerts visit <a href="https://am.k-space.ee">Alert manager page</a>.
- name: test_router
email_configs:
# - to: "{{ .GroupLabels.email }}"
- to: 'Song Meo <songmeo@k-space.ee>'
from: 'Alerting <alerting@k-space.ee>'
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,
<p>
You have the following firing alerts:
<ul>
{{ range .Alerts }}
<li>{{.Labels.alertname}} on {{ .Labels.instance }}</li>
{{ end }}
</ul>
</p>
For more info see <a href="https://prom.k-space.ee/alerts">Prometheus alerts page</a>.
<br><br>
To silence alerts visit <a href="https://am.k-space.ee">Alert manager page</a>.

View File

@ -15,6 +15,9 @@ kind: Alertmanager
metadata:
name: alertmanager
spec:
alertmanagerConfigSelector:
matchLabels:
alertmanagerConfig: email
nodeSelector:
dedicated: monitoring
tolerations: