【Prometheus专题】3. Prometheus监控组件的配置

时间:2020-10-21
本文章向大家介绍【Prometheus专题】3. Prometheus监控组件的配置,主要包括【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']

... 未完成,明天写

原文地址:https://www.cnblogs.com/DevOpsTechLab/p/13855206.html