配置

prometheus.yml的一个模板文件如下:

global:
  scrape_interval: 1m  # How frequently to scrape targets,default 1m  
  scrape_timeout: 10s  # How long until a scrape request times out, default 10s
  evaluation_interval: 1m # How frequently to evaluate rules, default 1m
  external_labels:  # The labels to add to any time series or alerts when communicating with external systems (federation, remote storage, Alertmanager).
    key: value   # optional

rule_files:
  - /path/node-cpu.yml
  - /path/node-memory.yml

scrape_configs:
  - job_name: 'node_exporter'
    static_configs:
    - targets: ['192.168.2.101:9100']
      labels:
        IP: 192.168.2.101
    - targets: ['192.168.2.102:9100']
      labels:
        IP: 192.168.2.102

alerting:
  alert_relabel_configs:
    [ - <relabel_config> ... ]
  alertmanagers:
  - static_configs:
    - targets: ['192.168.2.101:9093']

# Settings related to the remote write feature.
remote_write:
  [ - <remote_write> ... ]

# Settings related to the remote read feature.
remote_read:
  [ - <remote_read> ... ]

Reference

【1】https://prometheus.io/docs/prometheus/latest/configuration/configuration/

Last updated