banshee is under active development: collectors will keep changing, and a version you publish will likely need adjustments. For stable use, wait for version 1.0.0.

Windows

banshee/windows-collection/windows/ssh/

pagefile

The commit charge of a Windows against its limit, and the use of each paging file, by SSH and PowerShell

  • windows
  • ssh
  • powershell
  • pagefile
  • memory

by banshee1 installation2 versions

v2Latest

Published on October 28, 2026. One naming convention across collections; documentation completed.

Keen 1.0.0 · 47 lines
// The paging files of a Windows, by SSH, and the commit charge of the system: the memory programs have
// reserved, against the commit limit, physical memory and paging files together. When the commit charge
// reaches the limit, Windows refuses memory to programs: that is the figure to watch, more than the
// filling of a paging file.
// Runs one PowerShell command that only reads: Win32_OperatingSystem (TotalVirtualMemorySize, the commit
// limit, and FreeVirtualMemory, in KiB) and Win32_PageFileUsage (one object per paging file, sizes in MiB).
// A Windows may run without a paging file: the commit charge is then returned alone.
need('protocol:ssh');

per('pagefile', 'Paging files');
output('commit-limit', 'number', array('label' => 'Commit limit', 'unit' => 'MiB'));
output('committed', 'number', array('label' => 'Commit charge', 'unit' => 'MiB'));
output('commit-percent', 'number', array('label' => 'Commit charge', 'unit' => '%'));
output('size', 'number', array('label' => 'Paging file size', 'unit' => 'MiB', 'per' => 'pagefile'));
output('used', 'number', array('label' => 'Paging file used', 'unit' => 'MiB', 'per' => 'pagefile'));
output('used-percent', 'number', array('label' => 'Paging file used', 'unit' => '%', 'per' => 'pagefile'));

watch.above('commit-high', 'Commit charge high', 'commit-percent', array('warning' => 85, 'critical' => 95, 'for' => '3 runs'));
watch.above('pagefile-high', 'Paging file filling', 'used-percent', array('warning' => 80, 'critical' => 95, 'for' => '3 runs', 'enabled' => false));

$read = ssh.run("powershell -NoProfile -NonInteractive -Command \""
    . "ConvertTo-Json -Compress -Depth 4 -InputObject @{"
    . "os = (Get-CimInstance Win32_OperatingSystem | Select-Object TotalVirtualMemorySize, FreeVirtualMemory); "
    . "files = @(Get-CimInstance Win32_PageFileUsage | Select-Object Name, AllocatedBaseSize, CurrentUsage)}\"");
$answer = text.trim($read['output']);
if (list.count(text.match($answer, '^\{')) == 0) {
    fail('misconfigured', 'PowerShell did not return the commit charge', $answer . $read['errors']);
}
$memory = json.read($answer);
$limit = $memory['os']['TotalVirtualMemorySize'] / 1024;
if ($limit <= 0) {
    fail('misconfigured', 'Win32_OperatingSystem gives no commit limit', $answer);
}
$committed = $limit - $memory['os']['FreeVirtualMemory'] / 1024;
value('commit-limit', number.round($limit));
value('committed', number.round($committed));
value('commit-percent', number.round(100 * $committed / $limit, 1));

// A paging file being created has no size yet: it is left out until it has one.
foreach ($memory['files'] as $file) {
    if ($file['AllocatedBaseSize'] <= 0) {
        continue;
    }
    value('size', $file['AllocatedBaseSize'], $file['Name']);
    value('used', $file['CurrentUsage'], $file['Name']);
    value('used-percent', number.round(100 * $file['CurrentUsage'] / $file['AllocatedBaseSize'], 1), $file['Name']);
}