You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

部署prometheus-msteams时遇YAML反序列化错误求助

解决prometheus-msteams部署时YAML反序列化报错问题

报错信息

{"caller":"main.go:174","err":"yaml: unmarshal errors:\n  line 1: cannot unmarshal !!seq into main.PromTeamsConfig","ts":"2022-10-12T18:24:37.97854431Z"}

问题原因

这个错误的核心是:你的prometheus-msteams配置文件最外层用了列表(数组)格式(以-开头),但程序期望的是对象格式(键值对结构),导致YAML反序列化失败。

解决方案

单Teams通道场景

检查配置文件,确保最外层是键值对对象,而非列表:
错误示例(列表格式,会报错):

- alertmanager_url: "http://alertmanager:9093"
  teams_webhook_url: "https://outlook.office.com/webhook/xxx"

正确示例(对象格式):

alertmanager_url: "http://alertmanager:9093"
teams_webhook_url: "https://outlook.office.com/webhook/xxx"

多Teams通道路由场景

如果需要按规则将告警发送到不同Teams通道,需用routes字段包裹列表,最外层仍保持对象结构:

alertmanager_url: "http://alertmanager:9093"
routes:
  - match:
      severity: critical
    teams_webhook_url: "https://outlook.office.com/webhook/critical-channel"
  - match:
      severity: warning
    teams_webhook_url: "https://outlook.office.com/webhook/warning-channel"

修正配置后,重启prometheus-msteams服务即可解决该问题。

内容的提问来源于stack exchange,提问作者Marudsa Cifuentes

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.16 14:40:34