Windows机器的Prometheus出口商。
| 姓名 | 描述 | 默认情况下启用 |
|---|---|---|
| 广告 | Active Directory域服务 | |
| ADC | Active Directory证书服务 | |
| ADFS | 活动目录联合会服务 | |
| 缓存 | 缓存指标 | |
| 中央处理器 | CPU用法 | ✓ |
| cpu_info | CPU信息 | |
| CS | “计算机系统”指标(系统属性,数字/总存储器) | |
| 容器 | 容器指标 | |
| diskdrive | 磁盘指标 | |
| DFSR | DFSR指标 | |
| DHCP | DHCP服务器 | |
| DNS | DNS服务器 | |
| 交换 | 交换指标 | |
| filtime | filtime指标 | |
| FSRMQUOTA | Microsoft文件服务器资源管理器(FSRM)配额收集器 | |
| HyperV | Hyper-V主机 | |
| II | IIS网站和应用程序 | |
| 执照 | Windows许可证状态 | |
| Logical_disk | 逻辑磁盘,磁盘I/O | ✓ |
| 登录 | 用户登录会话 | |
| 记忆 | 内存使用指标 | ✓ |
| MSCluster | MSCluster指标 | |
| MSMQ | MSMQ队列 | |
| MSSQL | SQL Server性能对象指标 | |
| NetFramework | .NET框架指标 | |
| 网 | 网络接口I/O。 | ✓ |
| 操作系统 | OS指标(内存,进程,用户) | ✓ |
| 页面文件 | 页面文件指标 | |
| Performancecounter | 定制性能计数器指标 | |
| 物理_disk | 物理磁盘指标 | ✓ |
| 打印机 | 打印机指标 | |
| 过程 | 每个过程指标 | |
| 远程_FX | 远程FX协议(RDP)指标 | |
| 计划_task | 计划的任务指标 | |
| 服务 | 服务状态指标 | ✓ |
| SMB | SMB服务器 | |
| smbclient | SMB客户端 | |
| SMTP | IIS SMTP服务器 | |
| 系统 | 系统调用 | ✓ |
| TCP | TCP连接 | |
| terminal_services | 终端服务(RDS) | |
| textfile | 从文本文件中读取Prometheus指标 | |
| 热区 | 热信息 | |
| 时间 | Windows时间服务 | |
| UDP | UDP连接 | |
| 更新 | Windows Update Service | |
| VMware | VMware Guest Agent安装的性能计数器 |
有关报告的指标,配置设置和用法示例的更多信息,请参见每个收集器上的链接文档。
windows_exporter将默认情况下从已启用的收集器中曝光所有指标。这是收集指标以避免在比较不同家庭的指标时避免错误的推荐方法。
对于高级使用, windows_exporter可以通过可选的收集器列表来过滤指标。 collect[]参数可以多次使用。在Prometheus配置中,您可以在Scrape Config下使用此语法。
params:
collect[]:
- foo
- bar
这对于使不同的Prometheus服务器从节点收集特定的指标很有用。
Windows_Exporter接受标志以配置某些行为。在下面列出了配置出口商的全局行为的一种,而在上面的相应收集器文档中记录了特定于收集器的行为。
| 旗帜 | 描述 | 默认值 |
|---|---|---|
--web.listen-address | 主机:出口商端口。 | :9182 |
--telemetry.path | 浮出水面指标的URL路径。 | /metrics |
--telemetry.max-requests | 并发请求的最大数量。 0禁用。 | 5 |
--collectors.enabled | 逗号分隔的收藏家列表。使用[defaults]作为占位符,该占位符将扩展,其中包含默认情况下启用的所有收集器。” | [defaults] |
--collectors.print | 如果是真的,请打印可用的收藏家和出口。 | |
--scrape.timeout-margin | 从客户端允许的超时减去秒。调音以允许开销或高负载。 | 0.5 |
--web.config.file | 用于设置TLS和Auth的Web配置 | 没有任何 |
--config.file | 使用来自路径或URL的配置文件 | 没有任何 |
--config.file.insecure-skip-verify | 从URL加载配置文件时跳过TLS | 错误的 |
--log.file | 日志消息的输出文件。 [stdout,stderr,eventlog,<log file>] 注意: MSI安装程序将为已安装服务设置此设置的默认参数添加到EventLog | stderr |
最新版本可以从“发行”页面下载。
每个版本都提供.msi安装程序。安装程序将将Windows_Exporter设置为Windows服务,并在Windows防火墙中创建一个例外。
如果安装程序在没有任何参数的情况下运行,则出口商将使用启用收集器,端口等的默认设置运行。
安装程序提供了一个配置文件来自定义出口商。
配置文件
--config.file参数。可用以下参数:
| 姓名 | 描述 |
|---|---|
ENABLED_COLLECTORS | 作为--collectors.enabled标志,提供启用收集器的逗号分隔列表 |
CONFIG_FILE | 使用--config.file标志指定配置文件。如果空,则不会设置配置文件。特殊值config.yaml在安装dir处设置了config.yaml的路径 |
LISTEN_ADDR | IP地址要绑定到。默认为空字符串。 (任何本地地址) |
LISTEN_PORT | 要绑定的端口。默认为9182 。 |
METRICS_PATH | 服务指标的路径。默认为/metrics |
TEXTFILE_DIRS | 使用--collector.textfile.directories标志指定一个或多个由逗号隔开的目录,收集器应在其中读取包含指标的文本文件 |
REMOTE_ADDR | 允许设置逗号分隔为Windows防火墙异常的远程IP地址(允许列表)。默认为空字符串(任何远程地址)。 |
EXTRA_FLAGS | 允许传递完整的CLI标志。默认为空字符串。 for --collectors.enabled和--config.file ,请使用专用属性ENABLED_COLLECTORS和CONFIG_FILE |
ADDLOCAL | 在Windows_Exporter安装程序中启用功能。支持的值: FirewallException |
REMOVE | 禁用Windows_exporter安装程序中的功能。支持的值: FirewallException |
参数通过msiexec发送到安装程序。在PowerShell上,应在定义属性之前通过--% 。
示例调用:
msiexec / i < path - to - msi - file > --% ENABLED_COLLECTORS=os,iis LISTEN_PORT=5000带有自定义查询的示例服务收集器。
msiexec / i < path - to - msi - file > --% ENABLED_COLLECTORS=os,service EXTRA_FLAGS="--collectors.exchange.enabled=""ADAccessProcesses"""定义配置文件。
msiexec / i < path - to - msi - file > --% CONFIG_FILE="D:config.yaml"在某些较旧版本的Windows上,您可能需要用双引号包围参数值,以使安装命令正确解析:
msiexec / i C:UsersAdministratorDownloadswindows_exporter.msi --% ENABLED_COLLECTORS="ad,iis,logon,memory,process,tcp,textfile,thermalzone" TEXTFILE_DIRS="C:custom_metrics"要使用创建防火墙异常来安装出口商,请使用以下命令:
msiexec / i < path - to - msi - file > --% ADDLOCAL=FirewallException PowerShell版本7.3及更高版本要求使用psnativecommandargumentspasting在使用时将其设置为Legacy --% EXTRA_FLAGS :
$PSNativeCommandArgumentPassing = ' Legacy '
msiexec / i < path - to - msi - file > ENABLED_COLLECTORS = os , service --% EXTRA_FLAGS="--collectors.exchange.enabled=""ADAccessProcesses""" Windows_Exporter可以作为Docker容器运行。 Docker图像可在
docker.io/prometheuscommunity/windows-exporterghcr.io/prometheus-community/windows-exporterDocker映像用出口商的版本标记。 latest标签也可以使用,并指向最新版本。
此外,带有-hostprocess的风味hostprocess基于https://github.com/microsoft/windows-host-host-process-containers-base-imimimimage,其设计旨在作为Windows Host Process Container运行。该图像的大小小于默认图像。
请参阅此处的Windows Kubernetes上安装的详细步骤。
windows_exporter支持Windows Server版本2016及以后,以及桌面Windows版本10和11(21H2或更高版本)。
Windows Server 2012和2012R2仅作为最佳效果支持,但不能保证工作。
go get -u github.com/prometheus/promu
go get -u github.com/prometheus-community/windows_exporter
cd $env:GOPATH/src/github.com/prometheus-community/windows_exporter
promu build -v
.windows_exporter.exe
Prometheus指标将暴露在Local主机上:9182
Windows_exporter提供以下HTTP端点:
/metrics :以普罗米修斯文本格式公开指标。/health :出口商运行时将返回200。/debug/pprof/ :公开PPROF端点。仅设置--debug.enabled 。 .windows_exporter.exe --collectors.enabled "service" --collector.service.include="windows_exporter"
.windows_exporter.exe --collectors.enabled "process" --collector.process.include="firefox.+"
当有多个具有相同名称的过程时,WMI将第一个实例之后的过程表示为process-name#index 。因此,要使它们全部,而不仅仅是第一个,正则表达式必须使用.+ 。有关更多信息,请参见过程。
--collectors.enabled参数一起使用将[defaults]与--collectors.enabled参数一起使用。
.windows_exporter.exe --collectors.enabled "[defaults],process,container"
这使得默认值之上的其他过程和容器收集器。
可以用--config.file标志指定YAML配置文件。例如.windows_exporter.exe --config.file=config.yml 。如果您使用的是绝对路径,请确保引用该路径,例如.windows_exporter.exe --config.file="C:Program Fileswindows_exporterconfig.yml"
也可以从URL加载配置。例如.windows_exporter.exe --config.file="https://example.com/config.yml"
如果需要跳过TLS验证,则可以使用--config.file.insecure-skip-verify标志。例如.windows_exporter.exe --config.file="https://example.com/config.yml" --config.file.insecure-skip-verify
collectors :
enabled : cpu,net,service
collector :
service :
include : windows_exporter
log :
level : warn可以在此处找到一个示例配置文件。
配置文件值可以与CLI标志混合。例如
.windows_exporter.exe --collectors.enabled=cpu,logon
log :
level : debug与配置文件中指定的值相比,CLI标志享有更高的优先级。
在麻省理工学院