Use curl with parameters to return status code 200, use blackbox to return 400, why?
prometheus v2.15.2 blackbox-exporter:master
http_2xx_estate: prober: http timeout: 5s http: method: post headers: key: abc data: 123 Content-Type: application/json;charset=UTF-8 body: '{}'
- 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 -i -H "Content-Type:application/json" -X POST -d '{"key":"abc","data":"123"} https://xx.com/xxl/get/xxx HTTP/1.1 200 OK Server: openresty/1.15.8.3 Date: Tue, 12 May 2020 01:52:42 GMT Content-Type: application/json;charset=UTF-8
Use curl with parameters to return status code 200, use blackbox to return 400, why?
curl -iv -H "Content-Type:application/json;charset=UTF-8" -H "key:abc" -H "data:123" -X POST -d '{}' https://xx.com/xxl/get/xxx
http_2xx_estate: prober: http timeout: 5s http: method: post headers: key: abc data: 123 Content-Type: application/json;charset=UTF-8 body: '{}'
headers: key: abc data: 123 Content-Type: application/json;charset=UTF-8 body: '{}'
http: method: post headers: Content-Type: application/json body: '{"key":"abc","data":"123"}'