promethues容器运行报错
报错信息
level=error ts=2021-03-02T09:42:35.130Z caller=main.go:293 msg=“Error loading config (–config.file=/etc/prometheus/prometheus.yml)” err=“parsing YAML file /etc/prometheus/prometheus.yml: yaml: unmarshal errors:\n line 5: field rules_files not found in type config.plain\n line 11: field targets not found in type config.AlertmanagerConfig”
prometheus.yml配置
global:
scrape_interval: 60s
evaluation_interval: 60s
rules_files:
- /opt/prometheus/rules.yml
alerting:
alertmanagers:
- scheme: http
- static_configs:
- targets: ["localhost:9090"]
scrape_configs:
- job_name: prometheus
static_configs:
- targets: ['localhost:9090']
labels:
instance: prometheus
- job_name: node
static_configs:
- targets: ['*.*.*.*:9100']
labels:
instance: yx01
- targets: ['*.*.*.*:9100']
labels:
instance: yx02
-
第一处错误在第5行
rules_files
拼写错误,修改为
rule_files
-
第二处错误是
格式错误
,11行需要缩进
修改后
AlertManger规则不显示
http://localhost:9090/alerts 不显示告警项
- 使用绝对路径可能有问题,修改成相对路径
修改后
http://localhost:9093 alertmanager端接收不到告警
排查半天试了下将
prometheus.yml
中alertmanagers的地址
localhost
改为实际地址就可以接收到了
邮件也能接收
版权声明:本文为qq_28686911原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。