telegraf
telegraf copied to clipboard
Add Headers map to inputs.prometheus
Feature Request
I'd be interested in having the possibility to add specific headers to the GET request done by the inputs.prometheus plugin.
Proposal:
As it was mentioned here, maybe we can just add the same headers map[string]string that exists for other inputs plugin like httpjson.
We would then have:
[[inputs.prometheus]]
urls = ["http://localhost:9100/metrics"]
[inputs.prometheus.headers]
X-Auth-Token = "123"
Another-Header = "MyCustomerHeader"
Use case:
I have a use case where the application requires a specific header to be set.
I'm willing to help with the PR if needed, but I'm opening this feature request first to see if it's accepted or not.
I already created the changes in a personal fork: https://github.com/rnsc/telegraf/commits/feature/inputs-prometheus-headers
I would be interested in this functionality too.
As an example, an application like PowerDNS's DNSDist has a web server that exposes its metrics in prometheus format (see here), however, this requires that the X-API-Key header is set to authorise the request (see here)
Adding this functionality would allow me to query DNSDist directly for its prometheus metrics
Hello,
Can this be looked at? Thanks,
Hello @ssoroka @sjwang90 ,
Can you have a look at this Feature request and the PR I made? Do you think it can be merged? Or is it not a desired feature?
Thanks,
Agree, this is something we need as well. The endpoint we use exposes Prometheus metrics but needs a specific HTTP authentication header which bearer_token_string
does not support.
@rnsc there is a http_headers
option in the prometheus input, is this what you are looking for?
Hello! I am closing this issue due to inactivity. I hope you were able to resolve your problem, if not please try posting this question in our Community Slack or Community Forums or provide additional details in this issue and reqeust that it be re-opened. Thank you!