# Debug Prometheus Blackbox Exporter http\_2xx probs

**URL:** <https://discuss.prometheus.io/t/debug-prometheus-blackbox-exporter-http-2xx-probs/791>\
**Category:** General Help/Support\
**Created:** [February 17, 2022, 1:03pm UTC](https://discuss.prometheus.io/t/debug-prometheus-blackbox-exporter-http-2xx-probs/791 "2022-02-17T13:03:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mpg](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mpg](https://discuss.prometheus.io/u/mpg)\
**Post date:** [February 17, 2022, 1:03pm UTC](https://discuss.prometheus.io/t/debug-prometheus-blackbox-exporter-http-2xx-probs/791/1 "2022-02-17T13:03:36Z")

</div>

We are using the Prometheus Blackbox Exporter (blackbox\_exporter, version 0.19.0) to check HTTP endpoints. Now we need to implement a check with the `fail_if_body_matches_regexp` .  
The check should fail when a certain text exists inside the html body.  
For that, we created the following http prob configuration:

```auto
Module configuration:
prober: http
timeout: 5s
http:
    valid_http_versions:
        - HTTP/1.1
        - HTTP/2
        - HTTP/2.0
    preferred_ip_protocol: ip4
    ip_protocol_fallback: true
    fail_if_body_matches_regexp:
        - The page is temporarily unavailable
    follow_redirects: true
tcp:
    ip_protocol_fallback: true
icmp:
    ip_protocol_fallback: true
dns:
    ip_protocol_fallback: true

```

Unfortunately, the check does not work as expected. Even though the website contains `The page is temporarily unavailable` inside the html body, the check is still successful.

```auto
Logs for the probe:
ts=2022-02-17T09:46:31.403831228Z caller=main.go:320 module=http_2xx target=https://site.local level=info msg="Beginning probe" probe=http timeout_seconds=5
ts=2022-02-17T09:46:31.403959629Z caller=http.go:335 module=http_2xx target=https://site.local level=info msg="Resolving target address" ip_protocol=ip4
ts=2022-02-17T09:46:31.500911613Z caller=http.go:335 module=http_2xx target=https://site.local level=info msg="Resolved target address" ip=XXX.XXX.XXX.XXX
ts=2022-02-17T09:46:31.501017313Z caller=client.go:251 module=http_2xx target=https://site.local level=info msg="Making HTTP request" url=https://XXX.XXX.XXX.XXX host=site.local
ts=2022-02-17T09:46:31.614236162Z caller=main.go:130 module=http_2xx target=https://site.local level=info msg="Received HTTP response" status_code=200

Metrics that would have been returned:
# HELP probe_failed_due_to_regex Indicates if probe failed due to regex
# TYPE probe_failed_due_to_regex gauge
probe_failed_due_to_regex 0

```

To check, if the website is loaded correctly inside Prometheus Blackbox Exporter, I would like to check the html body which is received during the test. Does anyone know if that is possible and might have some further debug tips?

---

<div class="post-metadata">

**Author:** ![mpg](https://avatars.discourse-cdn.com/v4/letter/m/4bbf92/32.png) [@mpg](https://discuss.prometheus.io/u/mpg)\
**Post date:** [February 22, 2022, 7:53am UTC](https://discuss.prometheus.io/t/debug-prometheus-blackbox-exporter-http-2xx-probs/791/2 "2022-02-22T07:53:08Z")

</div>

I did not find further debug options, so I ended modifying the source code to print the received HTML body. We saw, that the website started to send compressed data and not “plain HTML”. Therefore, the check was failing.

There is now a merge request to add the HTML body inside debug mode:

> <https://github.com/prometheus/blackbox_exporter/pull/884>
>
> We had some troubles identifying why a specific HTTP probe with a \`fail\_if\_body\_…matches\_regexp\` did not work for a specific website. In the end, the website started to deliver compressed data, so the regex was not working. For identifying such cases, printing the received HTML body would be handy.
