windows_exporter
windows_exporter copied to clipboard
windows_os_info not correct
System: Windows 11 Exporter Version: 0.18.1 Problem: windows_os_info not correct
Hello,
in the Prometheus Browser / Targets / metrics my Windows 11 system appears as: product="Microsoft Windows 10 Pro", version="10.0.22000" classified. Am I doing something wrong??
best regards Thomas.
The os
collector uses an API I'm unfamiliar with, unfortunately.
@benridley or @retryW are you able to provide troubleshooting steps for this collector?
my windows_exporter on windows 11 metrics also show up as win 10
# HELP windows_os_info OperatingSystem.Caption, OperatingSystem.Version
# TYPE windows_os_info gauge
windows_os_info{product="Microsoft Windows 10 Pro",version="10.0.22000"} 1
Sorry all, have been traveling recently.
It looks like this information is read from the registry key SOFTWARE\Microsoft\Windows NT\CurrentVersion
, which appears to be staying as Windows 10, major version 10, even with Windows 11. I'll see if I can find an alternative way of fetching this info.
So I did some digging, and this appears to be a widely acknowledged issue. Unfortunately, the API calls and registry entries have not been updated to add a way to detect Windows 11.
Microsoft employees have apparently said:
At least for now, OS build number 22000 is the standard that distinguishes Windows 10 from Windows 11.
(from this StackOverflow answer)
We could potentially add in an exception that checks for this and corrects the value exported by windows_os_info for usability purposes, but I guess its worth acknowledging it would be a hack rather than a proper value exposed by the Windows API like the rest of those labels are.
Keeping an incorrect human name and relying on a particular build number isn't a great user experience :disappointed:. Thanks for researching this one @benridley!
My preference would be to document this for the os
collector and not perform any modifications to the value provided by Windows/Microsoft. We try to avoid "cooked" values with the exporter, instead presenting raw metrics to the user. The exporter providing a different value to the OS could be a cause of surprise for users in the future, though to be fair the current behaviour is already a surprise as proven by this thread.
Thoughts?
I agree @breed808, IMO it's better to keep the exporter 'pure' and move any handling for identifying Windows 11 up into the business logic of whatever is consuming the metrics.
One thing that might be worth doing though is exposing the major, minor, and build numbers as separate labels. Right now we concatenate them into a single version=maj.min.build
label, but adding them as separate labels would make things a bit easier when searching for Windows 11+ hosts in PromQL queries and the like, e.g.
windows_os_info{version=10.0.22000} 1
would become
windows_os_info{version=10.0.22000, major_version=10, minor_version=0, build_number=22000} 1
I'm happy to make a PR for this if you agree it's worth doing for this use case.
Sure, the proposed labels sound like a good option for users. Send through a PR and I'll get it merged.
Thanks @breed808, I've opened #1051 to address this one. Let me know if there's anything else I can do!