memory

check_memory

Checks the memory usage on the host.

There are several types of memory that can be checked:

physical: physical memory
swap: swap memory (pagefile on windows)
committed: committed memory as shown in the windows task manager (windows only, basically this is the physical + swap)
virtual: available windows virtual address space (windows only)

read more on windows virtual address space:

https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex

Implementation

Windows Linux FreeBSD MacOSX

Examples

Default Check

check_memory
OK - physical = 6.98 GiB, committed = 719.32 MiB|...

Changing the return syntax to get more information:

check_memory 'top-syntax=${list}' 'detail-syntax=${type} free: ${free} used: ${used} size: ${size}'
physical free: 35.00 B used: 7.01 GiB size: 31.09 GiB, committed free: 27.00 B used: 705.57 MiB size: 977.00 MiB |...

Example using NRPE and Naemon

Naemon Config

define command{
    command_name         check_nrpe
    command_line         $USER1$/check_nrpe -H $HOSTADDRESS$ -n -c $ARG1$ -a $ARG2$
}

define service {
    host_name            testhost
    service_description  check_memory
    use                  generic-service
    check_command        check_nrpe!check_memory!'warn=used > 80%' 'crit=used > 90%'
}

Argument Defaults

Argument Default Value
warning used > 80%
critical used > 90%
empty-state 0 (OK)
empty-syntax
top-syntax %(status) - ${list}
ok-syntax
detail-syntax %(type) = %(used)/%(size) (%(used_pct | fmt=%.1f )%)

Check Specific Arguments

Argument Description
type Type of memory to check. Default: physical,committed (win) or physical,swap (other)

Attributes

Filter Keywords

these can be used in filters and thresholds (along with the default attributes):

Attribute Description
used bytes with the type as key
type checked type, either ‘physical’ or ‘committed’, ‘swap’ or ‘virtual’ (windows only)
used Used memory in human readable bytes (IEC)
used_bytes Used memory in bytes (IEC)
used_pct Used memory in percent
free Free memory in human readable bytes (IEC)
free_bytes Free memory in bytes (IEC)
free_pct Free memory in percent
size Total memory in human readable bytes (IEC)
size_bytes Total memory in bytes (IEC)