在prometheus监控系统,prometheus的职责是采集,查询和存储和推送报警到alertmanager。本文主要介绍下prometheus的配置文件。
全局配置文件简介
默认配置文件
按 Ctrl+C 复制代码
按 Ctrl+C 复制代码
global: 此片段指定的是prometheus的全局配置, 比如采集间隔,抓取超时时间等。
rule_files: 此片段指定报警规则文件, prometheus根据这些规则信息,会推送报警信息到alertmanager中。
scrape_configs: 此片段指定抓取配置,prometheus的数据采集通过此片段配置。
alerting: 此片段指定报警配置, 这里主要是指定prometheus将报警规则推送到指定的alertmanager实例地址。
remote_write: 指定后端的存储的写入api地址。
remote_read: 指定后端的存储的读取api地址。
global片段主要参数
# How frequently to scrape targets by default.
[ scrape_interval: | default = 1m ] # 抓取间隔
# How long until a scrape request times out.
[ scrape_timeout: | default = 10s ] # 抓取超时时间
# How frequently to evaluate rules.
[ evaluation_interval: | default = 1m ] # 评估规则间隔
# The labels to add to any time series or alerts when communicating with
# external systems (federation, remote storage, Alertmanager).
external_labels: # 外部一些标签设置
[ : ... ]
scrapy_config片段主要参数
一个scrape_config 片段指定一组目标和参数, 目标就是实例,指定采集的端点, 参数描述如何采集这些实例, 主要参数如下
scrape_interval: 抓取间隔,默认继承global值。
scrape_timeout: 抓取超时时间,默认继承global值。
metric_