mirror of
https://github.com/prometheus-community/windows_exporter
synced 2024-12-27 17:02:04 +00:00
fix: Continue os collection on missing page file
Signed-off-by: Ben Reedy <breed808@breed808.com>
This commit is contained in:
parent
1493a20262
commit
29086368ac
@ -202,11 +202,13 @@ 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())
|
||||
}
|
||||
}
|
||||
|
||||
gpi, err := psapi.GetPerformanceInfo()
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user