prometheus / blackbox_exporter

Blackbox prober exporter
https://prometheus.io
Apache License 2.0
4.44k stars 1.03k forks source link

Support matching JSON body with CEL expressions #1255

Open juho9000 opened 1 month ago

juho9000 commented 1 month ago

This PR implements parsing a JSON response from the body and checking the result using a CEL query. Looking for feedback on this.

Sample usage:

modules:
  http_2xx:
    prober: http
    http:
      fail_if_body_json_not_matches_cel: "body.foo.bar == 'baz'"

If response is {"foo": { "bar": "qux" } } the probe fails. fail_if_body_json_matches_cel is also implemented and should work as expected.

juho9000 commented 2 weeks ago

@roidelapluie @mem Ping :)