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

Probe using proxy_url and skip_resolve_phase_with_proxy doesn't work as wanted #1154

Open
AlexanderKocheshkov opened this issue Nov 20, 2023 · 1 comment

Comments

@AlexanderKocheshkov
Copy link

Host operating system: output of uname -a

CentOS Stream 9

blackbox_exporter version: output of blackbox_exporter --version

blackbox_exporter, version 0.24.0 (branch: HEAD, revision: 0b04674)

What is the blackbox.yml module config.

http:
        http:
          proxy_url: "someurl"
          skip_resolve_phase_with_proxy
          preferred_ip_protocol: ip4
          tls_config:
            insecure_skip_verify: true
        prober: http
        timeout: 10s

What is the prometheus.yml scrape config.

- job_name: probe/blackbox-exporter
  honor_timestamps: true
  params:
    module:
    - http
  scrape_interval: 30s
  scrape_timeout: 10s
  metrics_path: /probe
  scheme: http
  follow_redirects: true
  relabel_configs:
  - source_labels: [job]
    separator: ;
    regex: (.*)
    target_label: __tmp_prometheus_job_name
    replacement: $1
    action: replace
  - source_labels: [__address__]
    separator: ;
    regex: (.*)
    target_label: __param_target
    replacement: $1
    action: replace
  - source_labels: [__param_target]
    separator: ;
    regex: (.*)
    target_label: instance
    replacement: $1
    action: replace
  - separator: ;
    regex: (.*)
    target_label: __address__
    replacement: blackbox-exporter:9115
    action: replace
  static_configs:
  - targets:
    - https://google.com/

What logging output did you get from adding &debug=true to the probe URL?

ts=2023-11-20T10:40:57.843171898Z caller=main.go:181 module=http target=https://google.com/ level=info msg="Beginning probe" probe=http timeout_seconds=10
ts=2023-11-20T10:40:57.843299518Z caller=client.go:252 module=http target=https://google.com/ level=info msg="Making HTTP request" url=https://google.com/ host=google.com
ts=2023-11-20T10:40:57.843490603Z caller=handler.go:120 module=http target=https://google.com/ level=error msg="Error for HTTP request" err="Get "https://google.com/\": proxyconnect tcp: dial tcp :0: connect: connection refused"
ts=2023-11-20T10:40:57.843511722Z caller=handler.go:120 module=http_internet target=https://google.com/ level=info msg="Response timings for roundtrip" roundtrip=0 start=2023-11-20T10:40:57.843369793Z dnsDone=2023-11-20T10:40:57.843369793Z connectDone=2023-11-20T10:40:57.843476007Z gotConn=0001-01-01T00:00:00Z responseStart=0001-01-01T00:00:00Z tlsStart=0001-01-01T00:00:00Z tlsDone=0001-01-01T00:00:00Z end=0001-01-01T00:00:00Z
ts=2023-11-20T10:40:57.843541977Z caller=main.go:181 module=http target=https://google.com/ level=error msg="Probe failed" duration_seconds=0.000332782

What did you do that produced an error?

Added a module that uses a proxy with skip_resolve_phase_with_proxy: true

What did you expect to see?

Successful probe

What did you see instead?

Failed probe

Detailed:

  1. I verified that the proxy works fine using network-multitool;
  2. I have configured a blackbox with a module that uses proxy and name resolving via 8.8.8.8;
  3. I ran a series of tests with different configurations;
  4. I used Wireshark+ksniff and Irealized that blackbox went to 127.0.0.1.
@datamuc
Copy link

datamuc commented Jul 25, 2024

if !module.HTTP.SkipResolvePhaseWithProxy || module.HTTP.HTTPClientConfig.ProxyConfig.ProxyURL.URL == nil || module.HTTP.HTTPClientConfig.ProxyConfig.ProxyFromEnvironment {
that logic is false, i think it should be:

if !module.HTTP.SkipResolvePhaseWithProxy || (module.HTTP.HTTPClientConfig.ProxyConfig.ProxyURL.URL == nil && !module.HTTP.HTTPClientConfig.ProxyConfig.ProxyFromEnvironment) {

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

No branches or pull requests

2 participants