作者:DYongLi | 来源:互联网 | 2023-10-11 08:15
What happened?
bearerTokenFile parameter not used when scrapping targets
Did you expect to see some different?
bearerTokenFile must be used in the authorization headers
How to reproduce it (as minimally and precisely as possible):
I followed the documentation here to deploy vault monitioring with prometheus - https://medium.com//yet-another-vault-monitoring-with-prometheus-blog-post-f525c862baca
1 2
| Client Version: version.Info{Major:"1", Minor:"15", GitVersion:"v1.15.3", GitCommit:"2d3c76f9091b6bec110a5e63777c332469e0cba2", GitTreeState:"clean", BuildDate:"2019-08-19T12:38:36Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.10", GitCommit:"37d169313237cb4ceb2cc4bef300f2ae3053c1a2", GitTreeState:"clean", BuildDate:"2019-08-19T10:44:49Z", GoVersion:"go1.11.13", Compiler:"gc", Platform:"linux/amd64"} |
Kubernetes cluster kind:
kops + EC2
Manifests:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
app.kubernetes.io/name: vault
name: vault
spec:
selector:
matchLabels:
app.kubernetes.io/name: vault
endpoints:
- interval: 30s
path: /v1/sys/metrics
params:
format:
- prometheus
port: http
scheme: http
scrapeTimeout: 30s
bearerTokenFile: /etc/prometheus/config_out/.vault-token |
- Prometheus Operator Logs:
I don't see any relevant logs for this issue
These are the logs I see in prometheus when I enable debug logging
1 2
| level=debug ts=2019-11-18T17:56:54.883Z caller=scrape.go:920 component="scrape manager" scrape_pool=default/vault/0 target="http://172.18.27.231:8200/v1/sys/metrics?format=prometheus" msg="Scrape failed" err="server returned HTTP status 400 Bad Request"
level=debug ts=2019-11-18T17:57:09.189Z caller=scrape.go:920 component="scrape manager" scrape_pool=default/vault/0 target="http://172.18.23.16:8200/v1/sys/metrics?format=prometheus" msg="Scrape failed" err="server returned HTTP status 400 Bad Request" |
该提问来源于开源项目:prometheus-operator/prometheus-operator
re-building the cluster seems to have fixed the issue