Linux
banshee/linux-collection/linux/ssh/
swap
Swap of a Linux by SSH: size, usage, and pages swapped in and out per second.
par banshee1 installation2 versions
Swap of a Linux, by SSH
Returns the size of the swap, what it holds, and the pages read back from it and written to it per second. Pages read back again and again say the memory is too small, far better than used swap, where the kernel readily stores pages nobody needs any more.
How it works
The collector runs cat /proc/meminfo /proc/vmstat and reads SwapTotal and SwapFree (in KiB) and the counters pswpin and pswpout (pages since boot).
- The pages per second come from the counters over the interval between two runs: the first run is skipped, as is a run where a counter went backwards.
- Portable: both files are written by the kernel the same way on Alpine, Debian and Fedora. Nothing is written on the target.
Prerequisites
- an SSH account for monitoring, without write rights;
- the fingerprint of the server's host key, set in
protocol:ssh:fingerprint(not needed when the Security settings trust the first SSH fingerprint presented).
Outputs
| Output | Unit | Meaning |
|---|---|---|
total | MiB | swap size |
used | MiB | swap in use |
used-percent | % | share of swap in use |
swap-in | pages/s | pages read back from swap |
swap-out | pages/s | pages written to swap |
Watches
| Watch | Kind | Defaults | Checked |
|---|---|---|---|
used-percent Swap saturated | above, on used-percent | warning 80, critical 95, for 3 runs | yes |
swapping Sustained swapping | above, on swap-in | warning 100, for 5 min | yes |
Limits
- A machine without swap (
SwapTotalat 0) stops the collectormisconfigured: the probe has nothing to measure, and says so rather than show green. - A page is 4 KiB on most machines, 16 or 64 KiB on some ARM systems:
swap-inandswap-outcount pages, not bytes.