Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

windows_os_info not correct #1022

Closed
flipp303 opened this issue Jul 18, 2022 · 8 comments · Fixed by #1052
Closed

windows_os_info not correct #1022

flipp303 opened this issue Jul 18, 2022 · 8 comments · Fixed by #1052

Comments

@flipp303
Copy link

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.

@breed808
Copy link
Contributor

The os collector uses an API I'm unfamiliar with, unfortunately.

@benridley or @retryW are you able to provide troubleshooting steps for this collector?

@grenade
Copy link

grenade commented Aug 16, 2022

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

@benridley
Copy link
Contributor

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.

@benridley
Copy link
Contributor

benridley commented Aug 19, 2022

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.

@breed808
Copy link
Contributor

Keeping an incorrect human name and relying on a particular build number isn't a great user experience 😞. 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?

@benridley
Copy link
Contributor

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.

@breed808
Copy link
Contributor

Sure, the proposed labels sound like a good option for users. Send through a PR and I'll get it merged.

@benridley
Copy link
Contributor

Thanks @breed808, I've opened #1051 to address this one. Let me know if there's anything else I can do!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants