推荐- 2024版 -prometheus配置文件详解 prometheus-console - 含 Prometheus热加载-Prometheus基础-Prometheus身份认证

在这里插入图片描述

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地址。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值