【Prometheus專題】3. Prometheus監控組件的配置

prometheus監控組件的配置的自由度並不是很高,也有一定得規範,總的還說還是中規中矩

Prometheus

首先我們來看一下默認的配置

# my global config
global:
  scrape_interval:     15s     # 多久 收集 一次數據
  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:
      # - 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']

這裏主要說明下alerting和prometheus監控自身部分的配置,因爲我們修改了服務的URL,所以默認的配置是無法發送告警的

alerting:
  alertmanagers:
  - static_configs:
    - targets: ['localhost:9093']
    path_prefix: '/alertmanager'
    timeout: 30s

- job_name: 'prometheus'
    scrape_interval: 60s
    metrics_path: '/prometheus/metrics'
    static_configs:
    - targets: ['localhost:9090']

... 未完成,明天寫

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章