prometheus windows_exporter windows_os_info无法获取的问题

Windows_exporter在运行时遇到错误,无法显示主机名和操作系统信息,问题源于缺少页面文件配置。解决方案是在注册表中添加'ExistingPageFiles'项,设置为空值,以修复无法找到文件的错误。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Windows_exporter不显示主机名、操作系统等信息的问题主机名和操作系统无法显示
终端运行windows_exporter --log.level=debug发现报错:

time="2022-04-25T19:12:06+08:00" level=error msg="failed collecting os metrics:<nil> The system cannot find the file specified." source="os.go:137"
time="2022-04-25T19:12:06+08:00" level=error msg="collector os failed after 0.014036s: The system cannot find the file specified." source="exporter.go:207"specified." source="exporter.go:207"

在官方github上找到解决办法:
https://github.com/prometheus-community/windows_exporter/issues/939

原因是终端未配置页面文件导致(pagefile.sys),解决方法是在注册表增加“ExistingPageFiles ”项目,空值即可:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v ExistingPageFiles /t REG_MULTI_SZ

2023.1.28更新
除以上pagefile原因外发现新的原因,现象同样是不显示主机名,系统版本等信息,debug日志包含 metrics: counter not found,例如:

time="2023-01-28T14:25:25+08:00" level=error msg="failed collecting net metrics:<nil> counter not found" source="net.go:137"
time="2023-01-28T14:25:25+08:00" level=error msg="collector net failed after 0.000000s: counter not found" source="exporter.go:207"
time="2023-01-28T14:25:25+08:00" level=error msg="failed collecting os metrics:<nil> counter not found" source="os.go:137"
time="2023-01-28T14:25:25+08:00" level=error msg="collector os failed after 0.007000s: counter not found" source="exporter.go:207"
time="2023-01-28T14:25:25+08:00" level=error msg="failed collecting system metrics:<nil> counter not found" source="system.go:73"
time="2023-01-28T14:25:25+08:00" level=error msg="collector system failed after 0.000000s: counter not found" source="exporter.go:207"
time="2023-01-28T14:25:25+08:00" level=error msg="collector cpu failed after 0.000000s: counter not found" source="exporter.go:207"
time="2023-01-28T14:25:25+08:00" level=error msg="failed collecting logical_disk metrics:<nil> counter not found" source="logical_disk.go:163"
time="2023-01-28T14:25:25+08:00" level=error msg="collector logical_disk failed after 0.000000s: counter not found" source="exporter.go:207"

解决方法:
重置windows性能计数器:

C:\Windows\system32>lodctr /r
Info: Successfully rebuilt performance counter setting from system backup store
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值