exporter@windows_exporter指标采集
windows_exporter(前身为 wmi_exporter)是一个用于在 Windows 系统上导出系统指标(metrics)到 Prometheus 的开源工具。它允许你收集各种系统级别的数据,用于监控和告警分析。
🔧 项目基本信息
- 项目名称:
windows_exporter - 原名:
wmi_exporter,自 2020 年后更名为windows_exporter - 代码仓库:
https://github.com/prometheus-community/windows_exporter - 运行平台:Windows(支持 Server 和 Desktop)
🎯 作用与功能
windows_exporter 主要用于在 Windows 系统上收集以下类型的系统指标,供 Prometheus 拉取:
支持的常见指标模块(Collectors)
| 模块名 | 说明 |
|---|---|
cpu |
CPU 使用率 |
memory |
内存使用情况 |
disk |
磁盘容量和IO统计 |
logical_disk |
挂载的逻辑磁盘使用情况 |
net |
网络接口统计 |
os |
操作系统信息(版本、启动时间等) |
system |
系统级别信息 |
service |
Windows 服务状态 |
process |
进程数和相关指标 |
tcp, udp |
TCP/UDP连接统计 |
hyperv |
Hyper-V 指标(虚拟化场景) |
textfile |
自定义指标文件收集(类似 Linux 的 node_exporter) |
可通过启动参数启用/禁用模块,例如:
windows_exporter.exe
# 支持自定义采集指标
windows_exporter.exe --collectors.enabled "cpu,logical_disk,net,os,system"
🚀 安装与使用方法(简要)
1. 下载
从 Releases 页面 下载适合的 .msi 安装包或 .exe 文件。
2. 安装为 Windows 服务
1 | windows_exporter-*.msi |
安装过程中可选择需要启用的模块,安装后服务会监听在默认端口 9182。
或者使用命令行手动运行:
1 | windows_exporter.exe --collectors.enabled "cpu,logical_disk,os,service" |
3. 验证
访问本地端口测试:
http://localhost:9182/metrics
📊 在 Prometheus 中配置抓取
Prometheus 的 prometheus.yml 中添加 job:
1 | scrape_configs: |
grafana dashboard
| 仪表盘 ID | 版本说明 |
|---|---|
| 14694 | 官方经典版,稳定通用 |
| 10467 / 20763 | 社区翻新版,界面更优化 |
| 19688 | 最新英文版,React 面板富交互 |
| 15024 | 专注 MSSQL 指标显示 |
- 推荐先从 14694 快速导入和浏览。
- 若你关注新版本、更多面板选项,尝试 19688 或新版 2024 仪表盘。
- 为更深入自定义,可根据
/metrics中现有指标自行创建或修改面板。
🧩 常见使用场景
- Windows 服务器性能监控(如 AD、文件服务器、IIS)
- 混合基础设施(Linux + Windows)统一监控
- 监控 Windows 服务的运行状态
- 自定义业务日志指标上报(结合 textfile)
📌 注意事项
- 默认监听端口为
9182,防火墙可能需要放行。 - 某些 Collector(如
hyperv)可能需要管理员权限或在特定 Windows 版本才可用。 - 不支持 HTTPS 直接导出,需要通过反向代理如 nginx 或 IIS 来配置加密传输。