From 8407f4aeb814330be96a4254b067a078d929547d Mon Sep 17 00:00:00 2001 From: Ben Reedy Date: Wed, 30 Dec 2020 20:09:18 +1000 Subject: [PATCH] Document version requirement for time collector Windows Server 2016 or newer is required for the collector, as the perflib counters were not exposed in previous versions. Signed-off-by: Ben Reedy --- collector/time.go | 6 ++++++ docs/collector.time.md | 2 ++ 2 files changed, 8 insertions(+) diff --git a/collector/time.go b/collector/time.go index 4ec4b5ab..dd1eee42 100644 --- a/collector/time.go +++ b/collector/time.go @@ -3,6 +3,8 @@ package collector import ( + "errors" + "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/common/log" ) @@ -22,6 +24,10 @@ type TimeCollector struct { } func newTimeCollector() (Collector, error) { + if getWindowsVersion() <= 6.1 { + return nil, errors.New("Windows version older than Server 2016 detected. The time collector will not run and should be disabled via CLI flags or configuration file") + + } const subsystem = "time" return &TimeCollector{ diff --git a/docs/collector.time.md b/docs/collector.time.md index 5e7c1ca8..8361cf68 100644 --- a/docs/collector.time.md +++ b/docs/collector.time.md @@ -3,6 +3,8 @@ The time collector exposes the Windows Time Service metrics. Note that the Windows Time Service must be running, else metric collection will fail. If the Windows Time Service is stopped after collection has started, collector metric values will reset to 0. +Please note the Time Service perflib counters are only available on [Windows Server 2016 or newer](https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-server-2016-improvements). + ||| -|- Metric name prefix | `time`