prometheus.yml 配置
最后更新于:2022-04-02 02:59:59
[TOC]
> [官方文档](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config)
## prometheus.yml 配置
语法
```
global:
# 默认情况下抓取目标的频率
[ scrape_interval: | default = 1m ]
# 获取请求设置超时时间
[ scrape_timeout: | default = 10s ]
# 多久评价一次规则
[ evaluation_interval: | default = 1m ]
# 发送时要添加到任何时间序列或警报的标签
external_labels:
[ : ... ]
# 记录PromQL查询的日志
[ query_log_file: ]
# 规则文件
rule_files:
[ - ... ]
# 抓取 target 的列表
scrape_configs:
[ - ... ]
# Alerting指定与Alertmanager相关的设置
alerting:
alert_relabel_configs:
[ - ... ]
alertmanagers:
[ - ... ]
# 远程写入
remote_write:
[ - ... ]
# 远程读取
remote_read:
[ - ... ]
```
##
# 设置单个抓取时间
[ scrape_interval: | default = ]
[ scrape_timeout: | default = ]
# 抓取的path
[ metrics_path: | default = /metrics ]
# 请求方式
[ scheme: | default = http ]
# 可选的HTTP URL参数
params:
[ : [, ...] ]
# # http 的基础验证
basic_auth:
[ username: ]
[ password: ]
[ password_file: ]
# 头部设置 token
[ bearer_token: ]
[ bearer_token_file: ]
# TLS设置
tls_config:
[ ]
# 代理地址
[ proxy_url: ]
# azure 服务发现
azure_sd_configs:
[ - ... ]
# Consul 服务发现
consul_sd_configs:
[ - ... ]
# 文件服务发现
file_sd_configs:
[ - ... ]
# k8s 服务发现
kubernetes_sd_configs:
[ - ... ]
# List of labeled statically configured targets for this job.
static_configs:
[ - ... ]
# 重新标记
relabel_configs:
[ - ... ]
metric_relabel_configs:
[ - ... ]
[ sample_limit: | default = 0 ]
```
';