0

I want to use "fail_if_body_not_matches_regexp" in blackbox_exporter to detect whether a string is returned in an HTTP interface (this interface is a url of type GET), but the result of blackbox_exporter page is always 401. by the way, I can normally access this interface through the browser and get the results

I wanted to detect rabbitMQ for split brain, but rabbitmq_exporter could not detect split brain.So I use HTTP probe in blackbox_exporter to do regexp match the results of the interface.But when I configured everything done. I visit the url "http://10.201.5.197:9115/probe?module=http_2rabbitmq_brainSplit&target=10.201.7.209%3A15672%2Fapi%2Fnodes".And blackbox always display 401, as shown below

# HELP probe_dns_lookup_time_seconds Returns the time taken for probe dns lookup in seconds
# TYPE probe_dns_lookup_time_seconds gauge
probe_dns_lookup_time_seconds 3.6954e-05
# HELP probe_duration_seconds Returns how long the probe took to complete in seconds
# TYPE probe_duration_seconds gauge
probe_duration_seconds 0.002106961
# HELP probe_failed_due_to_regex Indicates if probe failed due to regex
# TYPE probe_failed_due_to_regex gauge
probe_failed_due_to_regex 1
# HELP probe_http_content_length Length of http content response
# TYPE probe_http_content_length gauge
probe_http_content_length 54
# HELP probe_http_duration_seconds Duration of http request by phase, summed over all redirects
# TYPE probe_http_duration_seconds gauge
probe_http_duration_seconds{phase="connect"} 0.000388833
probe_http_duration_seconds{phase="processing"} 0.001160027
probe_http_duration_seconds{phase="resolve"} 3.6954e-05
probe_http_duration_seconds{phase="tls"} 0
probe_http_duration_seconds{phase="transfer"} 0.000159596
# HELP probe_http_redirects The number of redirects
# TYPE probe_http_redirects gauge
probe_http_redirects 0
# HELP probe_http_ssl Indicates if SSL was used for the final redirect
# TYPE probe_http_ssl gauge
probe_http_ssl 0
# HELP probe_http_status_code Response HTTP status code
# TYPE probe_http_status_code gauge
probe_http_status_code 401
# HELP probe_http_version Returns the version of HTTP of the probe response
# TYPE probe_http_version gauge
probe_http_version 1.1
# HELP probe_ip_protocol Specifies whether probe ip protocol is IP4 or IP6
# TYPE probe_ip_protocol gauge
probe_ip_protocol 4
# HELP probe_success Displays whether or not the probe was a success
# TYPE probe_success gauge
probe_success 0

My prometheus config.yaml:

  - job_name: 'rabbitma_brainSplit'
    metrics_path: /probe
    basic_auth:
      username: admin
      password: GSS1duS1Zdda
    params:
      module: [http_2rabbitmq_brainSplit]  
    static_configs:
      - targets:
        - 10.201.7.209:15672/api/nodes   
    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 10.201.5.197:9115

My black_exporter config.yml:

modules:
  http_2rabbitmq_brainSplit:
    prober: http
    timeout: 10s
    http:
      valid_http_versions: ["HTTP/1.1", "HTTP/2"]
      valid_status_codes: []  
      method: GET
      headers:
        Accept-Language: zh-CN,zh;q=0.9
      no_follow_redirects: false
      fail_if_ssl: false
      fail_if_not_ssl: false
      fail_if_body_not_matches_regexp:
      - '\"partitions\":\[\s+\]'

I expected the regexp match result of the fail_if_body_not_matches_regexp. Did I configure something wrong?

Esc
  • 521
  • 13
  • 30

1 Answers1

0

Prometheus blackbox exporter failing https but not http

  valid_http_versions:
    - "HTTP/1.1"
    - "HTTP/2.0"
itlux
  • 101
  • 2