如何为prometheus作业添加承载令牌

cbjzeqam  于 2021-09-30  发布在  Java
关注(0)|答案(0)|浏览(235)

我已经开始为我的微服务在普罗米修斯上工作。我最初能够做到这一点。现在,是时候将执行器端点推到Spring安全装置下了。添加安全性后,执行器期望来自普罗米修斯的承载令牌。因此,如何在prometheus作业中配置用户名和密码,以便prometheus从登录中获取承载令牌,并将其添加为所有请求的标头中的“授权”。
我使用下面的命令在docker容器中运行prometheus

1. $ docker run --name prometheus -p 9090:9090 -v prometheus.yml:/etc/prometheus/prometheus.yml -d prom/prometheus
 2. $ docker run --name grafana -d -p 3000:3000 grafana/grafana

下面是prometheus.yml文件


# 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).

# 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 time series scraped from this config.
  - job_name: 'prometheus'
    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
    static_configs:
      - targets: ['127.0.0.1:9090']

  - job_name: 'NL-APPLICATION'
    metrics_path: '/actuator/prometheus'
    scrape_interval: 5s
    scheme: http
    static_configs:
      - targets: ['172.17.0.1:8085']

  - job_name: 'NL-ADMIN-API'
    metrics_path: '/actuator/prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['172.17.0.1:8083']

如何指导普罗米修斯做以下事情
api调用“/login”使用用户名和密码获取承载令牌
将承载令牌添加为“授权”,作为所有api调用中的头

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题