prometheus告警配置注意事项

global:
  scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
  evaluation_interval: 15s # 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: ['100.101.201.131:9093']


rule_files:
  - 'rules.yml'
# - "second_rules.yml"


# Here it's Prometheus itself.
scrape_configs:

 - job_name: 'beta'
    scrape_timeout: 14s #超时时间必须少于即间隔scrape_interval,这里是14s,小于15s
    relabel_configs:
     regex: "(.*),(.+),(.*)" #正则匹配
     replacement: $2  #第二个
     action: replace #动作为替换
     target_label: "nodename" #目标的key为这个
    consul_sd_configs:
    - server: '127.0.0.1:8501'    

 

 

global:
  resolve_timeout: 2h
 
route:
  group_by: ['alertname']
  group_wait: 5s
  group_interval: 10s
  repeat_interval: 1h  #告警发送到webhook的间隔时间
  receiver: 'webhook'
 
receivers:
- name: 'webhook'
  webhook_configs:
  - url: 'http://127.0.0.1:5001/send'
    send_resolved: true

 

posted @ 2019-03-14 18:07  凯文队长  阅读(1235)  评论(0编辑  收藏  举报