mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
time: windows_time_clock_frequency_adjustment_ppb_total -> windows_time_clock_frequency_adjustment_ppb and add windows_time_clock_frequency_adjustment metric for Win2016 (#1910)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de> Signed-off-by: Jan-Otto Kröpke <github@jkroepke.de>
This commit is contained in:
@@ -20,10 +20,12 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"slices"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"unsafe"
|
||||
|
||||
"github.com/Microsoft/hcsshim/osversion"
|
||||
"github.com/prometheus-community/windows_exporter/internal/mi"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"golang.org/x/sys/windows"
|
||||
@@ -151,7 +153,18 @@ func NewCollectorWithReflection(resultType CounterType, object string, instances
|
||||
|
||||
var counterHandle pdhCounterHandle
|
||||
|
||||
//nolint:nestif
|
||||
if ret := AddEnglishCounter(handle, counterPath, 0, &counterHandle); ret != ErrorSuccess {
|
||||
if ret == CstatusNoCounter {
|
||||
if minOSBuildTag, ok := f.Tag.Lookup("perfdata_min_build"); ok {
|
||||
if minOSBuild, err := strconv.Atoi(minOSBuildTag); err == nil {
|
||||
if uint16(minOSBuild) > osversion.Build() {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
errs = append(errs, fmt.Errorf("failed to add counter %s: %w", counterPath, NewPdhError(ret)))
|
||||
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user