title: Usage of Physical and Virtual RAM
agents: linux
catalog: os/kernel
license: GPLv2
distribution: check_mk
description:
 This check measures the current usage of physical RAM and
 virtual memory used by processes. You can define a warning
 and critical level for the usage of virtual memory,
 {not} for the usage of RAM.

 This is not a bug, it's a feature. In fact it is the only way to do it right
 (at least for Linux): What parts of a process currently reside in physical
 RAM and what parts are swapped out is not related in a direct way with the
 current memory usage.

 Linux tends to swap out parts of processes even if RAM is available. It
 does this in situations where disk buffers (are assumed to) speed up the
 overall performance more than keeping rarely used parts of processes in RAM.

 For example after a complete backup of your system you might experiance
 that your swap usage has increased while you have more RAM free then
 before. That is because Linux has taken RAM from processes in order to
 increase disk buffers.

 So when defining a level to check against, the only value that is not
 affected by such internals of memory management is the total amount of
 {virtual} memory used up by processes (not by disk buffers).

 Checkmk lets you define levels in percentage of the physically installed RAM
 or as absolute values in MB. The default levels are at 150% and 200%. That
 means that this check gets critical if the memory used by processes is
 twice the size of your RAM.

 Hint: If you want to monitor swapping, you probably better measure major
 pagefaults. Please look at the check {kernel}.

discovery:
 One service is created on each host that provides the section {<<<mem>>>}.
 If that section also outputs information about the Windows page file,
 then the check {<<<mem.win>>>} creates a service instead.
