Re: [prometheus-users] blackbox exporter returns a '400 Bad Request' when called from prometheus

2,078 views
Skip to first unread message

Brian Brazil

unread,
Oct 8, 2021, 10:17:26 AM10/8/21
to Emmanuel Jaep, Prometheus Users

On Fri, 8 Oct 2021 at 15:12, Emmanuel Jaep <emmanu...@gmail.com> wrote:
I'm currently evaluating the blackbox exporter.

My docker-compose.yml looks like:
```
version: "3"

services:
prometheus:
image: prom/prometheus
restart: unless-stopped
volumes:
- "$PWD/shared/prometheus/etc/prometheus.yml:/etc/prometheus/prometheus.yml"
ports:
- 9090:9090
command:
- --config.file=/etc/prometheus/prometheus.yml

blackbox:
image: prom/blackbox-exporter:master
restart: unless-stopped
volumes:
- "$PWD/shared/blackbox/config:/config"
ports:
- 9115:9115
command:
- --config.file=/config/blackbox.yml
```

The prometheus configuration looks like:
```
global:
# How frequently to scrape targets
scrape_interval: 10s
# How frequently to evaluate rules
evaluation_interval: 10s
scrape_configs:

  - job_name: "blackbox"
    metrics_path: /probe
    params:
      module: [http_2xx] # Look for a HTTP 200 response.
    static_configs:
    - targets:
      - www.google.com
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: blackbox:9115 # The blackbox exporter's real hostname:port.
```

The stack can be brought up correctly.
When accessing the blackbox exporter from my machine, it works as expected:

However, prometheus is unable to reach blackbox exporter: server returned HTTP status 400 Bad Request

When I connect into the prometheus container, I can check that the port 9115 is correctly open and that blackbox is reachable:
```
$ nc -nv blackbox 9115
blackbox (172.20.0.2:9115) open
```

Connections to the blackbox main page works fine:
```
/prometheus $ wget http://blackbox:9115
Connecting to blackbox:9115 (172.20.0.2:9115)
saving to 'index.html'
index.html           100% |************************************************|   651  0:00:00 ETA
'index.html' saved
```

But connecting to the /probe fails:
```

This is a shell quoting issue, put quotes around the URL.

Brian
 
/prometheus $ Connecting to blackbox:9115 (172.20.0.2:9115)
wget: server returned error: HTTP/1.1 400 Bad Request
```

Did I miss something from the blackbox's configuration to make it accept connections from prometheus?

--
You received this message because you are subscribed to the Google Groups "Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/894b44ce-8965-4534-bcbe-ef99b775ede1n%40googlegroups.com.


--
Reply all
Reply to author
Forward
0 new messages