我目前正在尝试设置必须使用 IPv6 的内部 Prometheus 监控系统。我的静态配置不起作用:
- targets: ['[fe80::3086:7bff:fed8:f402]:9100']
这失败并出现错误
获取http://[fe80::3086:7bff:fed8:f402]:9100/metrics : 拨号 tcp [fe80::3086:7bff:fed8:f402]:9100: connect: 无效参数
我尝试使用 CURL 来查看是否可以连接到运行 node-exporter 的远程服务器。
这没有用:curl -g -6 'http://[fe80::3086:7bff:fed8:f402]:9100/metrics'
但这确实有效:curl -g -6 'http://[fe80::3086:7bff:fed8:f402%ens17]:9100/metrics'
这表明我实际上能够连接到服务器,但必须将连接 IPv6 网络顶部的网络接口添加到 URL 中。老实说,我不知道为什么。
但是现在,同样的 URL 对 prometheus 不起作用,仍然有一个错误:
- targets: ['[fe80::3086:7bff:fed8:f402%ens17]:9100']
Get http://[fe80::3086:7bff:fed8:f402%25ens17]:9100/metrics: dial tcp [fe80::3086:7bff:fed8:f402%ens17]:9100: connect: invalid argument