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

Feature request: add os version for Mac OS (Darwin) #2271

Closed
tomaszn opened this issue Jan 26, 2022 · 8 comments
Closed

Feature request: add os version for Mac OS (Darwin) #2271

tomaszn opened this issue Jan 26, 2022 · 8 comments

Comments

@tomaszn
Copy link

tomaszn commented Jan 26, 2022

Can be obtained with sw_vers:

$ sw_vers --help
Usage: sw_vers [-productName|-productVersion|-buildVersion]

$ sw_vers 
ProductName:	macOS
ProductVersion:	12.1
BuildVersion:	21C52

$ sw_vers 
ProductName:	Mac OS X
ProductVersion:	10.13.3
BuildVersion:	17D102
@discordianfish
Copy link
Member

We don't allow executing commands in the node-exporter but if there is a syscall or stdlib function to get that, we'd be open to including this.

@tomaszn
Copy link
Author

tomaszn commented Jan 27, 2022

Let me share a link to the sw_vers source code.

@discordianfish
Copy link
Member

Yeah looks like they are all available via CFDictionaryGetValue. So unless this needs root permissions it should be fine to add it here.

@tomaszn
Copy link
Author

tomaszn commented Feb 1, 2022

Similar values are in sysctl:

$ sysctl -a | grep kern.os
kern.ostype: Darwin
kern.osrelease: 17.4.0
kern.osrevision: 199506
kern.osversion: 17D102

$ sysctl -a | grep kern.os
kern.ostype: Darwin
kern.osrelease: 19.6.0
kern.osrevision: 199506
kern.osversion: 19H15
kern.osproductversion: 10.15.7

$ sysctl -a | grep kern.os
kern.ostype: Darwin
kern.osrelease: 21.2.0
kern.osrevision: 199506
kern.osversion: 21C52
kern.osproductversion: 12.1
kern.osproductversioncompat: 10.16
kern.osreleasetype: User

@pradeepnnv
Copy link

I would like to work on this.

@pradeepnnv
Copy link

I think this is already implemented.

curl http://localhost:9100/metrics |grep version

# HELP node_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, and goversion from which node_exporter was built.
node_exporter_build_info{branch="master",goversion="go1.18",revision="26e377dfd530655381085edb1cb3c4db9b12c816",version="1.3.1"} 1
node_uname_info{domainname="local",machine="x86_64",nodename="xxxxxxxx",release="21.2.0",sysname="Darwin",version="Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:54 PST 2021; root:xnu-8019.61.5~1/RELEASE_X86_64"} 1

Please let me know if this is still required.

@tomaszn
Copy link
Author

tomaszn commented Jun 26, 2022 via email

@maltelehmann
Copy link

This issue can be closed since the feature has been implemented with #2471

@SuperQ SuperQ closed this as completed Mar 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants