node_exporter
node_exporter copied to clipboard
Feature request: add os version for Mac OS (Darwin)
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
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.
Let me share a link to the sw_vers source code.
Yeah looks like they are all available via CFDictionaryGetValue. So unless this needs root permissions it should be fine to add it here.
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
I would like to work on this.
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.
It's about node_os_info
and node_os_version
metrics implemented for Linux in #1574 (after a discussion of it's needed).
This issue can be closed since the feature has been implemented with https://github.com/prometheus/node_exporter/pull/2471