From 29086368ac15227295c4332af103d9d818f4dcfb Mon Sep 17 00:00:00 2001 From: Ben Reedy Date: Fri, 16 Dec 2022 21:57:44 +1000 Subject: [PATCH] fix: Continue os collection on missing page file Signed-off-by: Ben Reedy --- collector/os.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/collector/os.go b/collector/os.go index b7673dfc..34bab42c 100644 --- a/collector/os.go +++ b/collector/os.go @@ -202,10 +202,12 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) ( for _, pagingFile := range pagingFiles { fileString := strings.ReplaceAll(pagingFile, `\??\`, "") file, err := os.Stat(fileString) + // For unknown reasons, Windows doesn't always create a page file. Continue collection rather than aborting. if err != nil { - return nil, err + log.Debugf("Failed to read page file (reason: %s): %s\n", err, fileString) + } else { + fsipf += float64(file.Size()) } - fsipf += float64(file.Size()) } gpi, err := psapi.GetPerformanceInfo()