首页 > 解决方案 > windows_exporter 服务在服务器重启后断开与 prometheus 的连接

问题描述

我正面临 windows_exporter 服务和 prometheus 连接的奇怪问题。我正在使用 Prometheus grafana 来监控我们的 windows vms (Azure)。Prometheus Grafana 服务器基于 Linux (Ubuntu)。

10 个关键的 Windows 服务器被添加到 Prometheus 目标历史记录中。一些 Windows 服务器 24/7 运行,其中一些设置为在一天结束时自动关闭并在第二天重新启动。

添加到普罗米修斯服务器时的初始目标工作正常,但是一旦服务器重新启动,一些服务器就会不一致地断开与普罗米修斯服务器的连接。

Windows 虚拟机操作系统:Windows 服务器 2016 /2019

curl from prometheus server to windows target : curl: (7) Failed to connect to 52.xxx.xxx.xxx port 9182: Connection refused (注意:在windows服务器中手动重启服务会重新建立连接)

在目标机器上检查时 windows_exporter 服务状态显示正在运行并且还设置为自动延迟启动,我也得到了 http://localhost:9182/metrics的指标响应

无论我们重启多少次,所有 linux 目标都运行良好。这个问题是因为最近的 Windows 更新吗?

还有其他人面临同样的问题并且有任何可能的解决方案吗?

感谢您的时间!

Prometheus.yml 文件:

 - job_name: 'Win_Server_1'
    scrape_interval: 4m
    static_configs:
            - targets: ['xx.1xx.xx.xx:9182']

  - job_name: 'Win_Server_2'
    scrape_interval: 4m
    static_configs:
            - targets: ['xx.1xx.xx.xx:9182']

  - job_name: 'Win_Server_3'
    scrape_interval: 4m
    static_configs:
            - targets: ['xx.1xx.xx.xx:9182']

标签: prometheusmonitoringgrafanaazure-monitoringprometheus-node-exporter

解决方案


推荐阅读