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

Accept HTTP headers in request parameters #816

Closed

Conversation

anemyte
Copy link
Contributor

@anemyte anemyte commented Aug 10, 2021

Hello,

I've come to a problem when I need to setup blackbox monitoring for each edge server under a domain name. I found this way to acheive that:

  • use dns_sd_config to get a list of server IP addresses;
  • create a module with hard-coded Host header in it:
modules:
  http_2xx_example:
    http:
      headers:
        Host: vhost.example.com
  • disable SSL check (still fails with CloudFlare) or try to set httpClientConfig.TLSConfig.ServerName via module configuration (I saw it as a part of the module but found no example).

Having several dozens domains to monitor, I considered this approach unsatisfying and so I made this feature. See the updated README.md for examples.

Also, this can be used to change User-Agent (#557).

@anemyte anemyte force-pushed the accept_http_headers_in_params branch from ef81367 to a584ae5 Compare August 10, 2021 14:25
Copy link
Contributor

@mem mem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but I'll defer to @roidelapluie for approval.

@roidelapluie
Copy link
Member

roidelapluie commented Sep 2, 2021

I'd rather go to have a hostname parameter directly, see https://docs.google.com/document/d/1VwqXi2TOb5KXaZY6Iio7411x64pJao3GusX8MqYsJ2g/edit#

@anemyte
Copy link
Contributor Author

anemyte commented Sep 3, 2021

I'd rather go to have a hostname parameter directly, see https://docs.google.com/document/d/1VwqXi2TOb5KXaZY6Iio7411x64pJao3GusX8MqYsJ2g/edit#

I don't mind changing this to a hostname parameter to set Host header and TLS SNI, since those two are the most dynamic part that requires a module per each domain name. However, there is a comment left by Joaquin:

Sorry if this has been talked about somewhere else, but what do you think of generalizing this to any header? header[XXX]=YYY or something like this

Which makes me think that not only I could benefit from the current general-case implementation. Allowing any header as a parameter makes it possible to use the default http_2xx module for most HTTP probe use cases. This is convenient because you have one config less to manage and the probe configuration is kept within scrape config, so you don't need to look for details somewhere else.

Let me know if you are adamant on this and I'll work on fix.

@roidelapluie
Copy link
Member

i have not changed my mind. HTTP headers hidden in Prometheus would be very complex to think about as users.

@anemyte anemyte mentioned this pull request Sep 11, 2021
@anemyte
Copy link
Contributor Author

anemyte commented Sep 11, 2021

Closing this in favor of #823

@anemyte anemyte closed this Sep 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants