【发布时间】:2021-08-20 06:50:13
【问题描述】:
设置
- job_name: "tse"
http_sd_configs:
- url: "http://tse.mydomain.url/something"
basic_auth:
username: "foo"
password: "bar"
metric_relabel_configs:
- source_labels: [__param_fccid]
regex: (.*)
target_label: fccid
replacement: ${1}
问题
在 Prometheus 中,我看到端点被抓取,并且端点包含fccid 参数。但是该参数未写入/保留为标签。
我从昨天开始尝试不同的东西(labelkeep、keep、replace、labelmap、relabel_configs),但没有任何效果。
metric_relabel_configs 是否不适用于 http_sd_configs?
【问题讨论】:
-
你试过
__meta_fccid而不是__param_fccid吗? -
@MichaelHausenblas:我试过了。不用找了。在 prometheus 的“Targets”页面中的“Labels”列中,参数写为
"__param_fccid"="12"。
标签: regex prometheus monitoring