gpt4 book ai didi

prometheus - 探针返回零

转载 作者:行者123 更新时间:2023-12-04 16:03:13 24 4
gpt4 key购买 nike

我一直在努力理解为什么某些 HTTP 端点为“probe_success”和“probe_http_status_code”返回“0”,同时完全能够通过 curl 获得“有效”响应。

示例:curl -s "localhost:9115/probe?target=http://linux.org&module=http_2xx" | grep -v '^#'
输出:

probe_dns_lookup_time_seconds 0.003712821
probe_duration_seconds 0.212811871
probe_failed_due_to_regex 0
probe_http_content_length 0
probe_http_duration_seconds{phase="connect"} 0.002263513
probe_http_duration_seconds{phase="processing"} 0.196389853
probe_http_duration_seconds{phase="resolve"} 0.006723945
probe_http_duration_seconds{phase="tls"} 0
probe_http_duration_seconds{phase="transfer"} 2.6001e-05
probe_http_redirects 1
probe_http_ssl 0
probe_http_status_code 0
probe_http_version 0
probe_ip_protocol 4
probe_success 0

这是作业定义:
  - job_name: 'blackbox'
scrape_interval: 30s
metrics_path: /probe
params:
module: [http_2xx]
static_configs:
- targets:
- http://linux.org
relabel_configs:
- source_labels: [__address__]
regex: '(.*)(:80)?'
target_label: __param_target
- source_labels: [__param_target]
regex: '(.*)'
target_label: instance
replacement: '${1}'
- source_labels: []
regex: '.*'
target_label: __address__
replacement: 'blackbox:9115'

和模块定义:
modules:
http_2xx:
prober: http
timeout: 15s
http:
valid_status_codes: []
method: GET

最佳答案

如果您附加 &debug=true您将获得有关错误的一些详细信息。

我的 猜测是 blackbox_exporter 无法连接,因为它默认为 ipv6 连接,这不起作用。

在我的情况下(同样的问题),调试输出说

level=error msg="Resolving target address" ip_protocol=ip6
level=error msg="Resolution with IP protocol failed (fallback_ip_protocol is false): err"
level=error msg="Error resolving address" err="address apple.com: no suitable address found"
level=error msg="Probe failed" duration_seconds=0.003648031

来自 blackbox documentation :
  # The IP protocol of the HTTP probe (ip4, ip6).
[ preferred_ip_protocol: <string> | default = "ip6" ]
[ ip_protocol_fallback: <boolean> | default = true ]

所以,如果你修改你的模块配置,它应该可以工作:
modules:
http_2xx:
prober: http
timeout: 15s
http:
valid_status_codes: []
method: GET
preferred_ip_protocol: "ip4" # <---- !

关于prometheus - 探针返回零,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54773928/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com