mirror of
https://github.com/prometheus-community/windows_exporter
synced 2025-01-30 19:35:01 +00:00
Merge pull request #1317 from DiniFarb/os_rev_num
feat(#1300): add revision to windows_os_info
This commit is contained in:
commit
569f5450cd
@ -53,7 +53,7 @@ func newOSCollector(logger log.Logger) (Collector, error) {
|
||||
OSInformation: prometheus.NewDesc(
|
||||
prometheus.BuildFQName(Namespace, subsystem, "info"),
|
||||
"OperatingSystem.Caption, OperatingSystem.Version",
|
||||
[]string{"product", "version", "major_version", "minor_version", "build_number"},
|
||||
[]string{"product", "version", "major_version", "minor_version", "build_number", "revision"},
|
||||
nil,
|
||||
),
|
||||
PagingLimitBytes: prometheus.NewDesc(
|
||||
@ -199,6 +199,11 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
revision, _, err := ntKey.GetIntegerValue("UBR")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var fsipf float64
|
||||
for _, pagingFile := range pagingFiles {
|
||||
fileString := strings.ReplaceAll(pagingFile, `\??\`, "")
|
||||
@ -242,6 +247,7 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
|
||||
fmt.Sprintf("%d", nwgi.VersionMajor), // Major Version
|
||||
fmt.Sprintf("%d", nwgi.VersionMinor), // Minor Version
|
||||
bn, // Build number
|
||||
fmt.Sprintf("%d", revision), // Revision
|
||||
)
|
||||
|
||||
ch <- prometheus.MustNewConstMetric(
|
||||
|
Loading…
Reference in New Issue
Block a user