我正在尝试将自定义的alert-routing配置添加到alertmanager,部署为kube-prometheus-stack的一部分。但是prometheus-operator pod在尝试生成alertmanager的Map时,由于以下错误而失败:
level=error ts=2021-05-31T06:29:38.883470881Z caller=klog.go:96 component=k8s_client_runtime func=ErrorDepth msg="Sync \"infra-services/prometheus-operator-kube-p-alertmanager\" failed: provision alertmanager configuration: base config from Secret could not be parsed: yaml: unmarshal errors:\n line 19: field matchers not found in type config.plain"
我还在alertmanager容器中使用amtool验证了同样的错误,它给出了同样的错误。下面是我的alertmanager.yml文件:
global:
resolve_timeout: 5m
slack_api_url: https://hooks.slack.com/services/xxxxxx/yyyyy/zzzzzzzzzzz
receivers:
- name: slack-notifications
slack_configs:
- channel: '#alerts'
send_resolved: true
text: '{{ template "slack.myorg.text" . }}'
- name: blackhole-receiver
route:
group_by:
- alertname
group_interval: 5m
group_wait: 30s
receiver: blackhole-receiver
repeat_interval: 12h
routes:
- matchers:
- severity=~"warning|critical"
receiver: slack-notifications
templates:
- /etc/alertmanager/config/*.tmpl
我遵循https://prometheus.io/docs/alerting/latest/configuration/和https://github.com/prometheus/alertmanager/blob/master/doc/examples/simple.yml来编写简单的alertmanager配置。
2条答案
按热度按时间7vhp5slm1#
尝试从以下更改:
收件人:
wfveoks02#
升级到(至少)
quay.io/prometheus/alertmanager:v0.22.2
,它就会工作。最好不要继续使用
match_re
,因为它已被弃用。