1. 程式人生 > 其它 >prometheus-主配置檔案詳解

prometheus-主配置檔案詳解

1. prometheus-主配置檔案詳解

  • 主機配置檔案詳解

    [root@iZj6cbgktk3zjpge312vq2Z prometheus]# cat prometheus.yml
    # my global config
    # 全域性配置
    global:
      scrape_interval:     15s  # 採集資料時間間隔
      evaluation_interval: 15s  # 每15秒評估規則。預設為1分鐘。
      scrape_timeout: 5s  # 採集資料超時時間,預設10秒
      # scrape_timeout is set to the global default (10s).
    
    # Alertmanager configuration   告警配置
    alerting:
      alertmanagers:
      - static_configs:
        - targets:
          # - alertmanager:9093
    
    # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
    rule_files:
      # - "first_rules.yml"
      # - "second_rules.yml"
    
    # A scrape configuration containing exactly one endpoint to scrape:
    # Here it's Prometheus itself.
    scrape_configs:
      # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
      - job_name: 'prometheus'
    
        # metrics_path defaults to '/metrics'
        # scheme defaults to 'http'.
    
        static_configs:
        - targets: ['localhost:9090']
    
    
    global:全域性配置
    	scrape_interval: 15s # 採集資料時間間隔
    	evaluation_interval: 15s # 評估告警規則時間間隔,預設1分鐘
    	scrape_timeout:5s # 採集資料超時時間,預設10秒
    
    rule_files:告警規則
    scrape_configs:配置被監控端,稱為target,每個target用job_name分組管理,又分為靜態配置和服務發現
    alerting:告警配置
    remote_write/remote_read:從遠端資料庫讀寫
    
  • 配置檔案