普罗米修斯规则错误

Prometheus Rules Error

我正在尝试启动 prometheus 警报 运行,但是在定义警报时,它总是告诉我语法错误

我用来启动 prometheus 的命令

./prometheus -config.file=prometheus.yml -alertmanager.url http://localhost:9093

这是我得到的错误

prometheus, version 0.15.1 (branch: master, revision: 64349aa)
  build user:       julius@julius-thinkpad
  build date:       20150727-17:56:51
  go version:       1.4.2
INFO[0000] Loading configuration file prometheus.yml     file=main.go line=173
ERRO[0000] Error loading rules, previous rule set restored: error parsing /home/ubuntu/alert.rules: Parse error at line 4, char 4: alert summary missing  file=manager.go line=348

这里是 alert.rule 文件

ALERT node_down
  IF up == 0
  FOR 5m
  LABELS {
    severity="critical"
  }
  ANNOTATIONS {
      summary = "Instance {{$labels.instance}} down",
      description = "{{$labels.instance}} of job {{$labels.job}} has been down for more than 5 minutes."
  }

这是我的 prometheus.yml 文件

global:
  scrape_interval:     15s 
  evaluation_interval: 15s 
'evaluation_interval'.
rule_files:
  - "/home/ubuntu/alert.rules"

scrape_configs:
  - job_name: 'prometheus'
    target_groups:
    - targets: ['localhost:9100','xxx.xxx.xxx.xxx:9100']

这是一个相当旧的 Prometheus 版本,它的警报语法略有不同。试试更新的版本。