Thanks for reply

prometheus-blackbox-exporter --config.file blackbox.yml --config.check
level=info ts=2021-04-01T06:26:46.112348123Z caller=main.go:215 
msg="Starting blackbox_exporter" version="(version=0.13.0+ds, 
branch=debian/sid, revision=0.13.0+ds-2+b11)"
level=error ts=2021-04-01T06:26:46.113104132Z caller=main.go:219 msg="Error 
loading config" err="Error parsing config file: yaml: unmarshal errors:\n  
line 17: cannot unmarshal !!seq into string"


 cannot unmarshal !!seq into string


  http_get_api_zkat:
    prober: http
    timeout: 5s
    http:
      method: GET
      headers:
        Content-Type: "application/json"
        fail_if_body_not_matches_regexp: 
        - "^{heheszki}$"


And even if I copy example config from blackbox-exporter config

cat blackbox2.yml

modules:
  http_2xx_example:
    prober: http
    timeout: 5s
    http:
      valid_http_versions: ["HTTP/1.1", "HTTP/2.0"]
      valid_status_codes: []  # Defaults to 2xx
      method: GET
      headers:
        Host: vhost.example.com
        Accept-Language: en-US
        Origin: example.com
      no_follow_redirects: false
      fail_if_ssl: false
      fail_if_not_ssl: false
      fail_if_body_matches_regexp:      <- this is line 16
        - "Could not connect to database"
      fail_if_body_not_matches_regexp:
        - "Download the latest version here"

prometheus-blackbox-exporter --config.file blackbox2.yml --config.check
level=info ts=2021-04-01T06:38:02.91294192Z caller=main.go:215 
msg="Starting blackbox_exporter" version="(version=0.13.0+ds, 
branch=debian/sid, revision=0.13.0+ds-2+b11)"
level=error ts=2021-04-01T06:38:02.913576183Z caller=main.go:219 msg="Error 
loading config" err="Error parsing config file: yaml: unmarshal errors:\n  
line 16: field fail_if_body_matches_regexp not found in type 
config.plain\n  line 18: field fail_if_body_not_matches_regexp not found in 
type config.plain"

czwartek, 1 kwietnia 2021 o 02:54:26 UTC+2 Marcelo Magallón napisał(a):

> 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/40d8dc77-6cea-49a7-b7dc-5b15d08fd608n%40googlegroups.com.

Reply via email to