apache_exporter
apache_exporter copied to clipboard
Add header support
Hello.
Thank you for this project!
I wondered if you could support adding multiple headers via CLI options.
e.g.
apache_exporter --header "Accept: */*" --header "User-Agent: something" --scrape_uri ...
The reason behind this is that we have a modSecurity (WAF) in "Front" of the Apache server and it logs false alerts for missing Accept header. Of course you could add an accept header by default, but it's probably better to make it configurable.
What do you think?
hi @ccremer
Maybe prometheus libraries need to be updated?
Seems there's an accept header being used for scrapes as seen here:
https://github.com/prometheus/prometheus/blob/b5c833ca2194db5581b8979048b3450cc869b88a/scrape/scrape.go#L528
Is that something you can look into?
Hi
I realize that I wasn't clear enough about the headers. It's the status-page (.../server-status
) from Apache that expects a header, not the exporter itself.
I guess somesomewhere in in the collect
function in https://github.com/Lusitaniae/apache_exporter/blob/master/apache_exporter.go#L172 is the right place.
So it's more like the exporter should add the headers to the collection request, not prometheus
sorry for the late response,
I think it doesn't justify allowing all kinds of dynamic headers. We can just add the Accept one for now.
Don't hesitate to make a PR, I'll try to get to it earlier!
Thanks for the response.
In our case, adding the Accept: */*
header "statically" is sufficient, so that works for us.
Cheers
I know you decided to not have it, but I am giving you the opportunity anyways :p I'm open to modify it
I think this was solved by #161
Many thanks! and sorry for the time it took