grafana / agent

Vendor-neutral programmable observability pipelines.
https://grafana.com/docs/agent/
Apache License 2.0
1.59k stars 485 forks source link

Custom HTTP headers for discovery.http #6261

Closed llamafilm closed 8 months ago

llamafilm commented 8 months ago

Request

I would like to set custom HTTP headers in discovery.http

Use case

I'm getting Prometheus targets from Netbox using this plugin: https://github.com/FlxPeters/netbox-plugin-prometheus-sd Netbox requires the Authorization: Token xxxx header for authentication. My Netbox system is behind an Apache proxy which uses Authorization for another purpose, so I rename the header using an Apache config like this:

RequestHeader set Authorization "expr=%{req:Netbox-Authorization}"

Therefore I need to set the Netbox-Authorization header.

erikbaranowski commented 8 months ago

it sounds like what you need is the proxy_connect_header configuration option available in prometheus http_sd_config and documented here:

https://prometheus.io/docs/prometheus/latest/configuration/configuration/#http_sd_config

I will look at wiring up the remaining proxy config options that were added to prometheus but not included in the agent yet.