
Prometheus 身份认证
http://www.ppmy.cn/news/18386.html
Prometheus 使用默认方式安装是不带有身份证认证和TLS,需要单独配置开启。
Prometheus 配置文件为yaml格式,并且单独配置,官网命名为web-config.yml,使用–web.config.file 命令加载。
web-config.yml
热加载
参考文章:https://www.cnblogs.com/yangmeichong/p/18157697
curl -XPOST http://localhost:9090/-/reload
先使用下面的命令访问prometheus查看是否正常
curl -X POST http://localhost:9090/-/reload
请求接口后返回 Lifecycle API is not enabled. 就是没有开启热更新配置 ,需在启动命令增加参数:–web.enable-lifecycle
具体启动命令
./prometheus --web.enable-lifecycle --config.file=prometheus.yml
使用容器 或者 systemctl 部署prometheus中,可以在运行参数中加入 --web.enable-lifecycle
例如:
ExecStart=/usr/local/prometheus/prometheus --web.enable-lifecycle --config.file=/usr/local/prometheus/prometheus.yml --storage.tsdb.path=/data/prometheus/data
Restart=on-failure
原文:https://www.cnblogs.com/zhaojiedi1992/p/zhaojiedi_liunx_60_prometheus_config.html
默认的配置文件
[root@node00 prometheus]# cat prometheus.yml.default
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
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']
global: 此片段指定的是prometheus的全局配置, 比如采集间隔,抓取超时时间等。
rule_files: 此片段指定报警规则文件, prometheus根据这些规则信息,会推送报警信息到alertmanager中。
scrape_configs: 此片段指定抓取配置,prometheus的数据采集通过此片段配置。
alerting: 此片段指定报警配置, 这里主要是指定prometheus将报警规则推送到指定的alertmanager实例地址。
remote_write: 指定后端的存储的写入api地址。
remote_read: 指定后端的存储的读取api地址。
968

被折叠的 条评论
为什么被折叠?



