Prometheus 警报测试问题

Prometheus alert test issue

我正在使用 Prometheus 2.5 并遵循此处的测试教程 https://prometheus.io/docs/prometheus/2.5/configuration/unit_testing_rules/ 我得到了

user@nb ~/Downloads/prometheus-2.5.0.linux-amd64 $ ./promtool check rules test.yml
Checking test.yml
  FAILED:
yaml: unmarshal errors:
  line 4: field rule_files not found in type rulefmt.RuleGroups
  line 7: field evaluation_interval not found in type rulefmt.RuleGroups
  line 9: field tests not found in type rulefmt.RuleGroups

我按照教程中的说明创建了 alerts.yml 和 test.yml。 不确定在哪里可以找到 rulefmt.RuleGroups 或如何更新它。

check rules 是规则文件的语法检查。您需要 test rules 到 运行 PromQL 单元测试。