2

我正在尝试在 Nomad 上运行 Prometheus。一切看起来都很好,但是当我添加带有模板的警报规则时,annotations它失败了。

这是一个简单的警报规则:

groups:
- name: alertmanager.rules
  rules:
  - alert: AlertmanagerDown
    expr: up{job="alertmanager"} == 0
    for: 1s
    labels:
      severity: critical
    annotations:
      description: 'Alertmanager on {{ $labels.role }} instance {{ $labels.node }} has not produced any metrics for 5 minutes'
      summary: 'Alertmanager is down on {{ $labels.role }} instance {{ $labels.node }}'

容器失败Template: (dynamic): parse: template: :10: undefined variable "$labels"

如果我删除annotations部分,它会毫无问题地开始。

4

1 回答 1

1

必须设置left_delimiter和以外的right_delimiter东西https://www.nomadproject.io/docs/job-specification/template.html#left_delimiter{{}}

于 2019-03-09T05:17:27.810 回答