Use curl with parameters to return status code 200, use blackbox to return 
400, why?

prometheus  v2.15.2blackbox-exporter:master

blackbox.yml

  http_2xx_estate:
    prober: http
    timeout: 5s
    http:
      method: post
      headers:
        key: abc
        data: 123
        Content-Type: application/json;charset=UTF-8
        body: '{}'

prometheus.yml

  - job_name: 'blackbox_estate'
    metrics_path: /probe
    params:
      module: [http_2xx_estate]  # Look for a HTTP 200 response.
    static_configs:
      - targets:
        - https://xx.com/xxl/get/xxx

    relabel_configs:
      - source_labels: [__address__]
        target_label: __param_target
      - source_labels: [__param_target]
        target_label: instance
      - target_label: __address__
        replacement: 192.168.201.165:9115  # The blackbox exporter's real 
hostname:port.

curl

curl -i -H "Content-Type:application/json" -X POST -d 
'{"key":"abc","data":"123"} https://xx.com/xxl/get/xxx HTTP/1.1 200 OKServer: 
openresty/1.15.8.3Date: Tue, 12 May 2020 01:52:42 GMTContent-Type: 
application/json;charset=UTF-8

-- 
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/4e90bf0b-48ab-4f67-a04a-3f3e4e3b5af2%40googlegroups.com.

Reply via email to