fail_if_body_not_matches_regexp is a list, so the second form should work. You can use the blackbox_exporter binary to validate the config:
$ blackbox_exporter --config.file=config.yml --config.check ... ... level=info ts=2021-04-01T00:53:23.671Z caller=main.go:233 msg="Config file is ok exiting..." On Wed, Mar 31, 2021 at 9:59 AM Michał Siwik <[email protected]> wrote: > > prometheus-blackbox-exporter --version > blackbox_exporter, version 0.13.0+ds (branch: debian/sid, revision: > 0.13.0+ds-2+b11) > build user: [email protected] > build date: 20190608-09:58:04 > go version: go1.11.6 > > Commented lines are one which cause failing > http_get_api_zkat: > prober: http > timeout: 5s > http: > method: GET > headers: > Content-Type: "application/json" > #fail_if_body_not_matches_regexp: "check_time" > #fail_if_body_not_matches_regexp > # - "check_time" > basic_auth: > username: "***" > password: "***" > > > środa, 31 marca 2021 o 17:55:34 UTC+2 Michał Siwik napisał(a): > >> My system is Debian (Linux gnu0 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 >> (2021-01-30) x86_64 GNU/Linux) >> >> I'm using blackbox exporter binary >> >> My blackbox.yml looks like this. When i try to add fail_if_body not >> matches regexp. Binary give me erros "failed with result 'exit-code''". I >> even copied example config and still it's failing. >> modules: >> http_2xx: >> prober: http >> http: >> http_post_2xx: >> prober: http >> http: >> method: POST >> tcp_connect: >> prober: tcp >> pop3s_banner: >> prober: tcp >> tcp: >> query_response: >> - expect: "^+OK" >> tls: true >> tls_config: >> insecure_skip_verify: false >> ssh_banner: >> prober: tcp >> tcp: >> query_response: >> - expect: "^SSH-2.0-" >> irc_banner: >> prober: tcp >> tcp: >> query_response: >> - send: "NICK prober" >> - send: "USER prober prober prober :prober" >> - expect: "PING :([^ ]+)" >> send: "PONG ${1}" >> - expect: "^:[^ ]+ 001" >> icmp: >> prober: icmp >> http_post_api_sowa: >> prober: http >> timeout: 5s >> http: >> method: POST >> headers: >> Content-Type: "application/json" >> body: '{"data_od": "2021-03-24","data_do": >> "2021-03-24","program_id": 73, "status": "ODRZUCONE"}' >> basic_auth: >> username: "*****" >> password: "*****" >> http_get_api_zkat: >> prober: http >> timeout: 5s >> http: >> method: GET >> headers: >> Content-Type: "application/json" >> #fail_if_body_not_matches_regexp: "check_time" >> #fail_if_body_not_matches_regexp >> # - "check_time" >> basic_auth: >> username: "***" >> password: "***" >> >> >> ● prometheus-blackbox-exporter.service - Blackbox exporter for Prometheus >> Loaded: loaded >> (/lib/systemd/system/prometheus-blackbox-exporter.service; enabled; vendor >> preset: enabled) >> Active: failed (Result: exit-code) since Wed 2021-03-31 17:42:03 CEST; >> 1s ago >> Docs: https://prometheus.io/docs/introduction/overview/ >> Process: 5470 ExecStart=/usr/bin/prometheus-blackbox-exporter $ARGS >> (code=exited, status=1/FAILURE) >> Main PID: 5470 (code=exited, status=1/FAILURE) >> >> Mar 31 17:42:03 gnu0 systemd[1]: prometheus-blackbox-exporter.service: >> Service RestartSec=100ms expired, scheduling restart. >> Mar 31 17:42:03 gnu0 systemd[1]: prometheus-blackbox-exporter.service: >> Scheduled restart job, restart counter is at 5. >> Mar 31 17:42:03 gnu0 systemd[1]: Stopped Blackbox exporter for Prometheus. >> Mar 31 17:42:03 gnu0 systemd[1]: prometheus-blackbox-exporter.service: >> Start request repeated too quickly. >> Mar 31 17:42:03 gnu0 systemd[1]: prometheus-blackbox-exporter.service: >> Failed with result 'exit-code'. >> Mar 31 17:42:03 gnu0 systemd[1]: Failed to start Blackbox exporter for >> 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/prometheus-users/b3f4f8ab-7d1a-44c1-a4a6-4db10a7961edn%40googlegroups.com > <https://groups.google.com/d/msgid/prometheus-users/b3f4f8ab-7d1a-44c1-a4a6-4db10a7961edn%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Marcelo Magallón -- 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/CABiJYgYq1P-2FWjiw55E-t7dcFQ-kJoaEeRia8vB2nu5BVnuqw%40mail.gmail.com.

