Я установил prometheus-operator через штурвал и теперь хочу установить настраиваемое правило оповещения, уведомления по электронной почте настроены, в настоящее время я получаю каждое уведомление, я хочу «отключить его», чтобы получать электронные письма для настраиваемых оповещений.
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: [email protected]
from: [email protected]
# Your smtp server address
smarthost: smtp.office365.com:587
auth_username: [email protected]
auth_identity: [email protected]
auth_password: pass
Вышеуказанный файл применен успешно,
я добавил следующие строки в конец указанного выше файла, как указано в здесь:
# 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 }}
А затем в журналах pod я получаю следующее:
="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"