prometheus-community / windows_exporter

Prometheus exporter for Windows machines
MIT License
2.86k stars 681 forks source link

Get "http://hostIP:9182/metrics": context deadline exceeded #1580

Open MjayTafe opened 3 weeks ago

MjayTafe commented 3 weeks ago

Problem Statement

I have install windows exporter on azure HCL node via powershell, I can see all data coming from port. but when i add to promethues it shows Get "http://10.176.2.25:9182/metrics": context deadline exceeded I can see other windows 2022 servers fine. except hci OS firewall port = ok crape_configs:

Environment

sandman98321 commented 3 weeks ago

There seems to be something off with the firewall settings the exporter install sets up, or the documentation is missing a necessary step. I was working on this tonight and had the same problem.

To add something more formal in terms of this being a bug or doc issue:

Windows 10 Pro, Version 22H2, build 19045.4780 Prom running in Portainer Stack on a Proxmox VM. All are on same subnet and no other VLANS on this network. Multiple other exports are working without problem. Prom build 2.53.1. windows_exporter version 0.27.2.

Steps to replicate: New install--start the .msi, allow the install to proceed. Allow Private Network access when prompted.

curl localhost:9182/metrics works fine at this point.

Prometheus/Targets/Status gives the context deadline exceeded error for that endpoint. Additionally, curl [desktop ip]:9182/metrics times out from any computer other than the Windows PC. Scrape interval and timeout make no difference. Letting curl sit there for 5 minutes got no data.

Testing/"Fix": Completely disabling the Defender Private Network Firewall results in an immediately working config in Prometheus, and curl from any other computer on local network being able to poll the data.

My suspicion: Either the app needs to be allowed through Public Network because "Windows Defender" reasons, or the Prom server needs to be whitelisted on the Windows side as an allowed inbound connection. I probably won't get to test that till the weekend.

Anyone have any other ideas?

Prom excerpt:

- job_name: [windows pc name here]
  honor_timestamps: true
  scrape_interval: 30s
  scrape_timeout: 60s
  metrics_path: /metrics
  scheme: http
  static_configs:
  - targets: ['[desktop ip]:9182']
jkroepke commented 3 weeks ago

I guess the important change is that one: https://github.com/prometheus-community/windows_exporter/pull/1447

And I have more to hight it.

The README says, if you want the firewall exception (which was created automaticly before) you have to run the msi with additional flags:

msiexec /i <path-to-msi-file> ADD_FIREWALL_EXCEPTION=yes
sandman98321 commented 3 weeks ago

Soo...I have a firewall exception that's enabled in there for allow inbound, when on private network on windows_exporter (I think because the .msi prompted me and asked if I wanted to add one? I know for sure I didn't create it. Thinking back, I did also run the .exe first, but since that left me with an open cmd window, I ran the .msi assuming the .exe wasn't an actual installer.).

I'll re-test this weekend and get back to you when I have time to uninstall and reinstall.

MjayTafe commented 3 weeks ago

I have installed Prometheus on CentOS, I checked with windows Prometheus client and that works well. issue only with windows host to centOS Prometheus .