mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-03-06 18:46:36 +00:00
Merge pull request #1108 from breed808/os_paging
fix: Continue os collection on missing page file
This commit is contained in:
@@ -202,10 +202,12 @@ func (c *OSCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metric) (
|
|||||||
for _, pagingFile := range pagingFiles {
|
for _, pagingFile := range pagingFiles {
|
||||||
fileString := strings.ReplaceAll(pagingFile, `\??\`, "")
|
fileString := strings.ReplaceAll(pagingFile, `\??\`, "")
|
||||||
file, err := os.Stat(fileString)
|
file, err := os.Stat(fileString)
|
||||||
|
// For unknown reasons, Windows doesn't always create a page file. Continue collection rather than aborting.
|
||||||
if err != nil {
|
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()
|
gpi, err := psapi.GetPerformanceInfo()
|
||||||
|
|||||||
Reference in New Issue
Block a user