(repost because I made a mess of the formatting last time)
Hi folks
New to Prometheus but liking it so far.
I'm trying to use the blackbox exporter to test an API. I want to check the
contents of the response body but I'm having trouble with regex that may or
may not be related to escaping the | character.
I'm sending in HL7 messages and getting a HL7 response, they make extensive
use of the pipe character.
My blackbox.yaml
http_post_2xx:
prober: http
http:
preferred_ip_protocol: "ip4"
method: POST
http_post_json:
prober: http
timeout: 5s
http:
method: POST
preferred_ip_protocol: "ip4"
headers:
Content-Type: application/json
body:
"MSH|^~\\&|MLEMS|TEST|MLEMS|TEST|20200102101206||ADT^A31|123456|P|2.4\n
<deletia>"
fail_if_body_not_matches_regexp:
- .*MSA|AE|123456$
The actual response body is plaintext as shown below
MSH|^~\&|EMS|RA9|PAS|RA9|20200307152450.723+0000||ACK^A31|3352|P|2.4
MSA|AA|123456
I'm only interested in the last line, specifically MSA|AA|123456
My problem is that this regex passes (which is fine) but if I change the
|AA| to |AE| i.e.
fail_if_body_not_matches_regexp:
- .*MSA|*AE*|123456$
A successful response i.e. one ending MSA|*AA*|123456 still passes????
I've tried escaping the | characters i.e.
fail_if_body_not_matches_regexp:
- .*MSA\|AE\|123456$
But then all messages fail.
I've tried various combinations of using double and single quotes but
haven't had any success although there's a fair chance I missed the right
combo.
Any help much appreciated
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/22b29a8c-551b-43cb-b2be-8c44e7551bcc%40googlegroups.com.