Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add header support #71

Closed
ccremer opened this issue Aug 8, 2019 · 7 comments
Closed

Add header support #71

ccremer opened this issue Aug 8, 2019 · 7 comments

Comments

@ccremer
Copy link

ccremer commented Aug 8, 2019

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?

@Lusitaniae
Copy link
Owner

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?

@ccremer
Copy link
Author

ccremer commented Aug 19, 2019

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

@Lusitaniae
Copy link
Owner

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!

@ccremer
Copy link
Author

ccremer commented Aug 23, 2019

Thanks for the response.
In our case, adding the Accept: */* header "statically" is sufficient, so that works for us.

Cheers

@AndreasPB
Copy link
Contributor

I know you decided to not have it, but I am giving you the opportunity anyways :p I'm open to modify it

@AndreasPB
Copy link
Contributor

I think this was solved by #161

@Lusitaniae
Copy link
Owner

Many thanks! and sorry for the time it took

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants