From d503ae05d44aec5b3395868774087e426f728368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 20 Apr 2024 21:46:02 +0200 Subject: [PATCH] Restore Windows 2012 support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- pkg/collector/os/os.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/collector/os/os.go b/pkg/collector/os/os.go index f78f59e79..501beda39 100644 --- a/pkg/collector/os/os.go +++ b/pkg/collector/os/os.go @@ -3,6 +3,7 @@ package os import ( + "errors" "fmt" "os" "strings" @@ -224,7 +225,9 @@ func (c *collector) collect(ctx *types.ScrapeContext, ch chan<- prometheus.Metri } revision, _, err := ntKey.GetIntegerValue("UBR") - if err != nil { + if errors.Is(err, registry.ErrNotExist) { + revision = 0 + } else if err != nil { return nil, err }