【发布时间】:2021-05-07 23:29:08
【问题描述】:
我有一个将被 Prometheus 监控的应用程序, 但是应用程序需要自定义标题键,例如:
x-auth-token: <customrandomtoken>
我应该如何处理 prometheus.yml?
【问题讨论】:
-
嗨,罗纳尔多,查看这个 Prometheus 文档链接:prometheus.io/docs/prometheus/latest/configuration/… 也许'bearer_token'或http'params'参数是你需要的。
yaml # Optional HTTP URL parameters. params: [ <string>: [<string>, ...] ] # Sets the `Authorization` header on every scrape request with # the configured bearer token. It is mutually exclusive with `bearer_token_file`. [ bearer_token: <secret> ] -
我需要自定义标头,例如``` x-api-token:
``` -
然后尝试使用 'params:' 添加 HTTP 标头
-
params 用于“可选的 HTTP URL 参数”,它绝对不是标头。
标签: monitoring prometheus prometheus-blackbox-exporter