📈 Monitoring

Windows Exporter + Grafana — Monitor Windows Metrics

Install windows_exporter to expose Windows system metrics (CPU, memory, disk, network, services) to Prometheus, then visualise them in Grafana. Full setup guide with Prometheus scrape config and recommended dashboard.

Architecture overview

Windows Host → windows_exporter :9182 → PrometheusGrafana

windows_exporter runs as a Windows Service and exposes a /metrics endpoint on port 9182. Prometheus scrapes this endpoint and stores the metrics. Grafana queries Prometheus and displays dashboards.

Step 1 — Download and install windows_exporter

Download the latest MSI from the windows_exporter releases page.

# Download with PowerShell $version = "0.30.4" $url = "https://github.com/prometheus-community/windows_exporter/releases/download/v$version/windows_exporter-$version-amd64.msi" Invoke-WebRequest -Uri $url -OutFile "windows_exporter.msi" # Install with common collectors enabled msiexec /i windows_exporter.msi ENABLED_COLLECTORS="cpu,memory,logical_disk,net,os,service,system,process" /quiet
Tip: The MSI installs windows_exporter as a Windows Service named windows_exporter and starts it automatically. Verify it's running at http://localhost:9182/metrics.

Available collectors

  • cpu — CPU usage per core and total
  • memory — RAM usage, page file
  • logical_disk — Disk I/O, free space per volume
  • net — Network bytes in/out per interface
  • os — OS version, uptime, users
  • service — Windows service states
  • process — Per-process CPU and memory
  • system — System calls, threads, processes
  • iis — IIS requests, connections
  • mssql — SQL Server metrics
  • scheduled_task — Task Scheduler states
  • tcp — TCP connection states

Step 2 — Open Windows Firewall for Prometheus scraping

# Allow Prometheus to scrape windows_exporter # Replace RemoteAddress with your Prometheus server IP New-NetFirewallRule ` -DisplayName "windows_exporter metrics" ` -Direction Inbound ` -Protocol TCP ` -LocalPort 9182 ` -RemoteAddress 192.168.1.100 ` -Action Allow

Step 3 — Add scrape target in Prometheus

Edit your prometheus.yml and add the Windows host as a target:

scrape_configs: - job_name: "windows" static_configs: - targets: - "192.168.1.50:9182" # Replace with your Windows host IP - "192.168.1.51:9182" # Add more hosts as needed labels: environment: production os: windows
# Reload Prometheus config Invoke-WebRequest -Uri "http://localhost:9090/-/reload" -Method POST -UseBasicParsing

Step 4 — Import Grafana dashboard

The Grafana community provides a ready-made Windows dashboard. Import it with one click:

1

Open Grafana → Dashboards → Import

Go to Dashboards → New → Import.

2

Enter dashboard ID

Enter 14694 (Windows Exporter Full dashboard) in the Grafana.com dashboard ID field and click Load.

3

Select Prometheus data source

In the import dialog, select your Prometheus data source and click Import.

Other popular dashboards: ID 10467 (Windows Node), ID 20763 (Windows Exporter Overview). Search grafana.com/grafana/dashboards for more.

Useful PromQL queries for Windows

# CPU usage % (all cores average) 100 - (avg by (instance) (rate(windows_cpu_time_total{mode="idle"}[5m])) * 100) # Memory usage % 100 - (windows_os_physical_memory_free_bytes / windows_cs_physical_memory_bytes * 100) # Disk free space % for C: drive windows_logical_disk_free_bytes{volume="C:"} / windows_logical_disk_size_bytes{volume="C:"} * 100 # Windows service down (state != running) windows_service_state{state!="running"} # Network bytes received/sec rate(windows_net_bytes_received_total[5m])

Troubleshooting

Metrics endpoint not reachable

# Check windows_exporter service Get-Service -Name "windows_exporter" # Test locally Invoke-WebRequest "http://localhost:9182/metrics" -UseBasicParsing | Select-Object -ExpandProperty Content | Select-Object -First 20

Missing metrics / collector not loading

Check the windows_exporter log in Event Viewer → Application. Some collectors (e.g. mssql) require additional permissions or the corresponding Windows component to be installed.