I have installed prometheus-operator via helm and now want to set custom alert rule, email notifications are set up, currently i'm getting every notification, i want to "silence it" so i can get emails for custom alerts.
alertmanager.yaml:
global:
resolve_timeout: 5m
route:
receiver: 'email-alert'
group_by: ['job']
routes:
- receiver: 'email-alert'
match:
alertname: etcdInsufficientMembers
group_wait: 30s
group_interval: 5m
repeat_interval: 12h
receivers:
- name: email-alert
email_configs:
- to: receiver@example.com
from: sender@example.com
# Your smtp server address
smarthost: smtp.office365.com:587
auth_username: sender@example.com
auth_identity: sender@example.com
auth_password: pass
Above file is applied sucessfully,
i added following lines at the end of above file, as referenced here:
# Example group with one alert
groups:
- name: example-alert
rules:
# Alert about restarts
- alert: RestartAlerts
expr: count(kube_pod_container_status_restarts_total) > 0
for: 1s
annotations:
summary: "More than 5 restarts in pod {{ $labels.pod-name }}"
description: "{{ $labels.container-name }} restarted (current value: {{ $value }}s) times in pod {{ $labels.pod-namespace }}/{{ $labels.pod-name }}
And then in pod logs i'm getting this:
="Loading configuration file failed" file=/etc/alertmanager/config/alertmanager.yaml err="yaml: unmarshal errors:\n line 28: field groups not found in type config.plain"