Querying Response Body via Blackbox Exporter.

37 views
Skip to first unread message

yagyans...@gmail.com

unread,
Jul 31, 2020, 4:42:48 PM7/31/20
to Prometheus Users

Hi. I am using the below module to fail the probe whenever the response body is anything else other than 'green', and it is working fine. But how do I get the response body when the probe fails? Eg. If the response body is 'red', then probe_success is showing to be zero, but how do I query or get what is the response body returned by the URL at this point when probe_success is zero.

Here is the module configuration I am using.
  http_healthcheck_es:
    prober: http
    timeout: 5s
    http:
      valid_http_versions: ["HTTP/1.1", "HTTP/2.0", "HTTP/1.0"]
      fail_if_body_not_matches_regexp: ['green']
      method: GET
      no_follow_redirects: false
      fail_if_ssl: false
      fail_if_not_ssl: false
      tls_config:
        insecure_skip_verify: true
      preferred_ip_protocol: "ip4"

Brian Candler

unread,
Aug 1, 2020, 3:22:48 AM8/1/20
to Prometheus Users
You can't with Prometheus + blackbox_exporter.

Prometheus stores only numeric (float64) values.  Labels are strings, but to work properly it also requires a limited set of distinct label values (to avoid cardinality explosion). Therefore, blackbox_exporter doesn't put arbitrary dynamic text in labels.

You would need to look at a logging system, such as loki, which can store arbitrary text logs.

Yagyansh S. Kumar

unread,
Aug 2, 2020, 4:33:50 PM8/2/20
to Brian Candler, Prometheus Users
That's a little strange. We can specify that the probe should fail if the response body does not match a given pattern, but we cannot extract the pattern that is returned by the URL. Quite a basic functionality that would have been nice to have.
Anyways, thanks for the help!

--
You received this message because you are subscribed to a topic in the Google Groups "Prometheus Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/prometheus-users/XHAu_A-OVEI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to prometheus-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/prometheus-users/b1f02919-2627-42fe-b4b2-0d4452d8a7b9o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages