Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os collector fails when paging file is disabled (>= v0.17.0) #939

Closed
MrNiceforest opened this issue Feb 11, 2022 · 5 comments · Fixed by #954
Closed

os collector fails when paging file is disabled (>= v0.17.0) #939

MrNiceforest opened this issue Feb 11, 2022 · 5 comments · Fixed by #954
Labels

Comments

@MrNiceforest
Copy link

MrNiceforest commented Feb 11, 2022

Having the Windows paging file disabled on all volumes results in the "os" collector failing on v0.17.0 or newer with below error.
Either running an older version (i.e. v0.16.0) or setting a paging file again (w/ system reboot for some reason) mitigates this, but would be great if this could be fixed in the exporter/collector again in an upcoming version.
Tested on both Windows 10 LTSC 2021 and Windows Server 2022.

failed collecting os metrics:<nil> The system cannot find the file specified.
collector os failed after 0.003015s: The system cannot find the file specified.
@breed808
Copy link
Contributor

There's been similar issues raised with the recent changes to the os collector, but there hadn't been an association with the paging file until now.

I'll see if I can reproduce this myself, and determine the cause.

@ticteam
Copy link

ticteam commented Feb 21, 2022

same issue here!
collector os failed after 0.001917s: CreateFile R:\pagefile.sys: The system cannot find the file specified.

  • windows_exporter version 0.18.1
  • Windows server 2016
  • EventID 102
    started with:
    "C:\Program Files\windows_exporter\windows_exporter.exe" --log.format logger:eventlog?name=windows_exporter --collectors.enabled ad,cpu,dns,dhcp,exchange,iis,logical_disk,logon,memory,net,os,process,service,system,tcp --telemetry.addr :9182

@to-kr
Copy link

to-kr commented Mar 9, 2022

This is a problematic line of code: it requires ExistingPageFiles in the registry. ExistingPageFiles key is missing when paging file is disabled.

The workaround we use until fixed is to create an empty registry key, before running windows_exporter.
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v ExistingPageFiles /t REG_MULTI_SZ

pagingFiles, _, err := memManKey.GetStringsValue("ExistingPageFiles")

@breed808
Copy link
Contributor

Thanks @to-kr, you've made it very easy to fix this 👍

@alexandream87
Copy link

I have 2 servers with Windows Server 2012 R2 and the page file is active. The collector tries to fetch a file from drive "z:", but it doesn't exist.
For some reason this value is in the environment variable ExistingPageFiles.

level=error msg="collector os failed after 0.00 5006s: CreateFile Z:\\pagefile.sys: The system cannot find the path specified." source="exporter.go:207"

ExistingPageFiles: \??\C:\pagefile.sys \??\Z:\pagefile.sys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants