pagefile: read the paging file size from the % Usage base (#2722)

Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
Jan-Otto Kröpke
2026-10-15 17:57:30 +00:00
committed by GitHub
parent b90371616b
commit 94b0eff655
7 changed files with 129 additions and 25 deletions
+6 -4
View File
@@ -5,7 +5,7 @@ The pagefile collector exposes metrics about the pagefile usage
|||
-|-
Metric name prefix | `pagefile`
Data source | Performance counter `Paging File`, `GetPerformanceInfo`
Data source | Performance counter `Paging File` (`% Usage` and its base), `GetPerformanceInfo` (page size)
Enabled by default? | No
## Flags
@@ -17,16 +17,18 @@ None
| Name | Description | Type | Labels |
|--------------------------------|-----------------------------------------------------------------------------------------------------------------------------|-------|--------|
| `windows_pagefile_free_bytes` | Number of bytes that can be mapped into the operating system paging files without causing any other pages to be swapped out | gauge | `file` |
| `windows_pagefile_limit_bytes` | Number of bytes that can be stored in the operating system paging files. 0 (zero) indicates that there are no paging files | gauge | `file` |
| `windows_pagefile_limit_bytes` | Current size of the paging file in bytes | gauge | `file` |
Both values come from the `% Usage` counter: its raw value is the number of pages in use and its base is the size of
the paging file in pages. They are multiplied by the system page size. A paging file without a valid size is left out.
### Example metric
```
# HELP windows_pagefile_free_bytes OperatingSystem.FreeSpaceInPagingFiles
# HELP windows_pagefile_free_bytes Number of bytes that can be mapped into the operating system paging files without causing any other pages to be swapped out
# TYPE windows_pagefile_free_bytes gauge
windows_pagefile_free_bytes{file="C:\\pagefile.sys"} 6.025797632e+09
# HELP windows_pagefile_limit_bytes OperatingSystem.SizeStoredInPagingFiles
# HELP windows_pagefile_limit_bytes Current size of the paging file in bytes
# TYPE windows_pagefile_limit_bytes gauge
windows_pagefile_limit_bytes{file="C:\\pagefile.sys"} 6.442450944e+09
```