刚开始使用 prometheus,我想它可以用来监控它是否可以通过 VPN 连接监控服务可用性。
所以我在盒子 A 上有了 prometheus 服务器本身。现在我需要监控端口 9000 上的 IP 172.20.40.40 是否可用。那是VPN另一边的盒子。我们将该服务服务器称为服务器 C。现在我的 IP 为 192.169.1.10 的盒子 B 能够访问盒子 C,因为它是加密域的一部分。我们在盒子 B 上安装了 blackbox 导出器,因此它可以检查盒子 C。
我相信普罗米修斯会从盒子 B 中获取盒子 C 的信息。以下是我的配置
黑盒配置
modules:
http_2xx:
prober: http
timeout: 5s
http:
valid_status_codes: []
method: GET
普罗米修斯配置
- job_name: 'blackbox'
metrics_path: /probe
params:
module: [http_2xx] # Look for a HTTP 200 response.
static_configs:
- targets:
- https://pagertree.com
- https://www.google.com
- http://172.20.40.40:9000
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: "blackbox_exporter:9115"
我没有在普罗米修斯文档中看到允许设置黑盒本身 IP 的部分。在黑盒文档上,黑盒配置看起来也不应该包含目标 IP。所以我有点困惑。难道是黑盒应该只在普罗米修斯所在的地方运行