prometheus windows_exporter 无法获取windows_os_info
现象
grafana上不显示主机名,系统版本等信息
排查
查看exporter的日志,debug日志包含 metrics: counter not found
time="2023-06-01T14:25:25+08:00" level=error msg="failed collecting net metrics:<nil> counter not found" source="net.go:137"
time="2023-06-01T14:25:25+08:00" level=error msg="collector net failed after 0.003287s: counter not found" source="exporter.go:207"
time="2023-06-01T14:25:25+08:00" level=error msg="failed collecting os metrics:<nil> counter not found" source="os.go:137"
time="2023-06-01T14:25:25+08:00" level=error msg="collector os failed after 0.003287s: counter not found" source="exporter.go:207"
time="2023-06-01T14:25:25+08:00" level=error msg="failed collecting system metrics:<nil> counter not found" source="system.go:73"
time="2023-06-01T14:25:25+08:00" level=error msg="collector system failed after 0.003287s: counter not found" source="exporter.go:207"
time="2023-06-01T14:25:25+08:00" level=error msg="collector cpu failed after 0.003287s: counter not found" source="exporter.go:207"
time="2023-06-01T14:25:25+08:00" level=error msg="failed collecting logical_disk metrics:<nil> counter not found" source="logical_disk.go:163"
time="2023-06-01T14:25:25+08:00" level=error msg="collector logical_disk failed after 0.003287s: counter not found" source="exporter.go:207"
解决:
重置windows性能计数器:
- 用管理员用户打开终端
C:\Windows\system32>lodctr /r
Info: Successfully rebuilt performance counter setting from system backup store