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/

volumes

The space of each local volume of a Windows, and when it will be full, by SSH and PowerShell

  • windows
  • ssh
  • powershell
  • volumes
  • disk

by banshee1 installation2 versions

Volumes of a Windows, by SSH

Returns the size, the space used and the free space of each local volume of a Windows, those with a drive letter and those mounted in a folder. Four watches are proposed, each one set on the probe. The activity of the disks is the collector windows/ssh/diskio.

How it works

The collector runs one PowerShell command that reads Win32_Volume:

powershell -NoProfile -NonInteractive -Command "[Console]::OutputEncoding = New-Object System.Text.UTF8Encoding; ConvertTo-Json -Compress -InputObject @(Get-CimInstance Win32_Volume -Filter 'DriveType=3' | Where-Object Capacity | Select-Object Name, Capacity, FreeSpace)"
  • Only volumes of the type "local disk" (DriveType 3) are read, and only those formatted (with a Capacity): network, removable and optical drives are not among them.
  • A volume is named as Windows names it: C:`, or the folder where it is mounted (D:\Data`). A volume with neither, named `\?\Volume{…}` (a recovery or system partition), is left out.
  • Sizes are in bytes, returned in GiB, rounded to a tenth.
  • The output is written in UTF-8 without a byte order mark, so that a folder name outside ASCII reads right.
  • Nothing is skipped at the first run.
  • No local volume at all, or an answer that is not the expected JSON, stops the collector as misconfigured: a Windows always has its system volume.

Nothing is written to the Windows: the command only reads.

Prerequisites

  • The OpenSSH server of Windows, installed and started: - on Windows Server 2019 and later, Windows 10 (version 1809 and later) and Windows 11, where it is built in: the optional feature "OpenSSH Server" (Settings, Optional features; or Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0 in PowerShell), then the service sshd started and set to start automatically; - on Windows Server 2012, 2012 R2 and 2016, Windows 8, 8.1 and the earlier Windows 10, where it is not built in: OpenSSH for Windows installed from its Microsoft release (Win32-OpenSSH), then the service sshd started and set to start automatically.
  • The default shell of the OpenSSH server left at cmd.exe, as it is installed: the collector starts PowerShell itself, and a command meant for cmd.exe would be read differently by a PowerShell default shell.
  • Windows PowerShell 3.0 or later, as shipped with every Windows from Server 2012 and Windows 8 on (3.0 on Server 2012, 4.0 on 2012 R2, 5.1 from 2016 on).
  • An account for monitoring, without administrator rights, member of the local groups "Performance Monitor Users" and "Event Log Readers", so that the performance counters and the System log are not refused to it. banshee reads it in protocol:ssh:user, with its password in protocol:ssh:password or its key in protocol:ssh:private-key (the public key then in C:\Users\<account>.ssh\authorized_keys).
  • The fingerprint of the server's host key, set in protocol:ssh:fingerprint (on the server, C:\ProgramData\ssh\ssh_host_ed25519_key.pub); not needed when the Security settings trust the first SSH fingerprint presented.
  • The Windows firewall open to the poller on TCP 22 (the rule "OpenSSH SSH Server (sshd)", created with the feature).

Outputs

NameLabelUnitPer instance
totalSizeGiByes, per volume
usedSpace usedGiByes, per volume
freeFree spaceGiByes, per volume
used-percentSpace used%yes, per volume

Watches

NameTitleKindDefaultsChecked by default
usedSpace usedabove a threshold, on used-percentwarning above 80 %, critical above 90 %yes
full-soonFull within the weekabove a threshold, on used-percent, with a trendwarning when the trend reaches more than 99 % within 7 days; no criticalyes
freeLittle free spacebelow a threshold, on freecritical below 5 GiB; no warningno
missingVolume missingexpected instances, on used-percentno volume named: it raises nothing until names are set on the probeyes

"Full within the week" needs the history of the volume: until the poller has learnt it, the watch says it is learning and raises nothing.

Limits

  • A USB disk that Windows announces as a local disk is counted.
  • Not yet checked on a real Windows: that the output in UTF-8 reaches the poller as such through the OpenSSH server.