Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prometheus can't load rule_files #5349

Closed
ighack opened this Issue Mar 13, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@ighack
Copy link

ighack commented Mar 13, 2019

prometheus, version 2.7.2 (branch: HEAD, revision: 82f98c8)
build user: root@ab86c672c33a
build date: 20190302-14:57:04
go version: go1.11.5

All program in docker.

prometheus.yml

# my global config
global:
  scrape_interval:     10s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 10s # Evaluate rules every 15 seconds. The default is every 1 minute.
  # scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
  alertmanagers:
  - static_configs:
    - targets: ['192.168.0.238:9093']

# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
  # - "first_rules.yml"
  # - "second_rules.yml"
  - "/docker/prometheus/sd_config/alert_rules/alertmanager_rules.yml"

alertmanager_rules.yml

groups:
 - name: alert-name
   rules:
   - alert: InstanceDown # 告警名称
     expr: up == 0 # 告警的判定条件,参考Prometheus高级查询来设定
     for: 2m # 满足告警条件持续时间多久后,才会发送告警
     labels: #标签项
       team: node
     annotations: # 解析项,详细解释告警信息
       summary: "{{$labels.instance}}: has been down"
       description: "{{$labels.instance}}: job {{$labels.job}} has been down "
       value: {{$value}}

but I can see any rules in web.
http://192.168.0.10:9090/alerts
I get "No alerting rules defined "

http://192.168.0.10:9090/rules
I get "No rules defined "

In alertmanager web
http://192.168.0.238:9093/#/alerts
I get "No alerts found"

erte

56346435

alert

rules

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Mar 13, 2019

It makes more sense to ask questions like this on the prometheus-users mailing list rather than in a GitHub issue. On the mailing list, more people are available to potentially respond to your question, and the whole community can benefit from the answers provided.

@ighack

This comment has been minimized.

Copy link
Author

ighack commented Mar 14, 2019

in alertmanager_rules.yml

value: {{$value}}
must be value: "{{$value}}"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.