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
| Windows | Linux | FreeBSD | MacOSX |
|---|---|---|---|
| ✅ | ✅ | ✅ | ✅ |
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 |
|---|---|
| n|procs-to-show | Number of processes to show when printing the top consuming processes |
| show-args | Show arguments when listing the top N processes |
| 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) |
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%'
}