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 here.

Implementation

WindowsLinuxFreeBSDMacOSX
✅✅✅✅

Argument Defaults

ArgumentDefault Value
warningused > 80%
criticalused > 90%
empty-state0 (OK)
empty-syntax
top-syntax%(status) - %(list)
ok-syntax
detail-syntax%(type) = %(used)/%(size) (%(used_pct | fmt=%.1f )%)

Check Specific Arguments

ArgumentDescription
n|procs-to-showNumber of processes to show when printing the top consuming processes
show-argsShow arguments when listing the top N processes
typeType 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):

AttributeDescription
used bytes with the type as key
typechecked type, either ‘physical’ or ‘committed’, ‘swap’ or ‘virtual’ (Windows only)
usedUsed memory in human readable bytes (IEC)
used_bytesUsed memory in bytes (IEC)
used_pctUsed memory in percent
freeFree memory in human readable bytes (IEC)
free_bytesFree memory in bytes (IEC)
free_pctFree memory in percent
sizeTotal memory in human readable bytes (IEC)
size_bytesTotal memory in bytes (IEC)

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 check_snclient and Naemon

Naemon Config

define command{
    command_name         check_snclient
    command_line         $USER1$/check_snclient -k -p 'your-password' -u 'https://$HOSTADDRESS$:8443' $ARG1$ $ARG2$
}

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