gpt4 book ai didi

kubernetes - 由于 "unmarshal errors: line 19: field matchers not found in type config.plain",Alertmanager 失败

转载 作者:行者123 更新时间:2023-12-04 14:07:01 36 4
gpt4 key购买 nike

我正在尝试将自定义警报路由配置添加到我的警报管理器,作为 kube-prometheus-stack 的一部分进行部署。但是 prometheus-operator pod 在尝试生成 alertmanager configmap 时由于以下错误而失败:

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编写我的简单警报管理器配置。

最佳答案

尝试从以下更改:

  routes:
- matchers:
- severity=~"warning|critical"
receiver: slack-notifications
到:
  routes:
- match_re:
severity: "warning|critical"
receiver: slack-notifications

关于kubernetes - 由于 "unmarshal errors: line 19: field matchers not found in type config.plain",Alertmanager 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67769403/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com