比如现在 probe_success{env="prod",project="example",instance="https://example.com"} - 0 查询出来的结果是 0,表示这个域名不通,但是我在服务器上测试是可以通的 http 状态码是 200
那么我可以请求下 blackbox 的接口进行测试
1 2 3 4
| curl -sG "http://blackbox-exporter:9115/probe" \ --data-urlencode "module=http_2xx" \ --data-urlencode "target=https://example.com" \ --data-urlencode "debug=true"
|
测出来的结果为;
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| [root@vos-gateway-c876594cf-6k5t4 /]# curl -sG "http://blackbox-exporter:9115/probe" \ --data-urlencode "module=http_2xx" \ --data-urlencode "target=https://example.com" \ --data-urlencode "debug=true" Logs for the probe: ts=2026-11-19T03:06:34.087684326Z caller=main.go:190 module=http_2xx target=https://example.com level=info msg="Beginning probe" probe=http timeout_seconds=5 ts=2026-11-19T03:06:34.087771495Z caller=http.go:328 module=http_2xx target=https://example.com level=info msg="Resolving target address" target=example.com ip_protocol=ip4 ts=2026-11-19T03:06:34.101953973Z caller=http.go:328 module=http_2xx target=https://example.com level=info msg="Resolved target address" target=example.com ip=119.91.247.218 ts=2026-11-19T03:06:34.102009317Z caller=client.go:259 module=http_2xx target=https://example.com level=info msg="Making HTTP request" url=https://119.91.247.218 host=example.com ts=2026-11-19T03:06:34.2355494Z caller=handler.go:119 module=http_2xx target=https://example.com level=info msg="Received HTTP response" status_code=200 ts=2026-11-19T03:06:34.235590231Z caller=handler.go:119 module=http_2xx target=https://example.com level=error msg="Invalid HTTP version number" version=HTTP/2.0
...
|
其中有一行报错为:
msg="Invalid HTTP version number" version=HTTP/2.0
说明这个版本号不在 valid_http_versions 配置里,可以修改下 blackbox 的配置文件,把
1 2 3
| valid_http_versions: - HTTP/1.1 - HTTP/2
|
改成
1 2 3
| valid_http_versions: - HTTP/1.1 - HTTP/2.0
|