Table of Contents
Check Memory (RAM)
Script: check_memory
check_memory Check memory usage incl. free, used and total memory.
It reads /proc/meminfo and fetches the needed values.
- MemTotal: Total usable ram (i.e. physical ram minus a few reserved bits and the kernel binary code)
- MemFree: Is sum of LowFree+HighFree (overall stat)
- MemAvailable: delta of total - free
- Buffers: Memory in buffer cache. mostly useless as metric nowadays Relatively temporary storage for raw disk blocks shouldn’t get tremendously large
- Cached: Memory in the pagecache (diskcache) minus SwapCache, Doesn’t include SwapCached
- SwapCached: Memory that once was swapped out, is swapped back in but still also is in the swapfile (if memory is needed it doesn’t need to be swapped out AGAIN because it is already in the swapfile. This saves I/O )
- SwapTotal: Total amount of physical swap memory.
- SwapFree: Total amount of swap memory free. Memory which has been evicted from RAM, and is temporarily on the disk
- Slab: in-kernel data structures cache
- SReclaimable: reclaimable parts of Slab, e.g., caches
This plugin sends all values as performance data.
Requirements
- bc
Standalone installation
From this repository ypu need next to this script:
-
inc_pluginfunctions
shared function for all IML checks written in bash
Syntax
______________________________________________________________________
CHECK_MEMORY
v1.10
(c) Institute for Medical Education - University of Bern
Licence: GNU GPL 3
https://os-docs.iml.unibe.ch/icinga-checks/Checks/check_memory.html
______________________________________________________________________
Check memory usage incl. free, used and total memory.
On higher memory usage the process table with top 5 top consumers will
be shown.
This plugin sends performancedata.
SYNTAX:
check_memory [-w WARN_LIMIT] [-c CRITICAL_LIMIT] [-s SWAP_LIMIT] [-p PROCESS_LIMIT] [-h]
OPTIONS:
-w VALUE Warning level for RAM usage [%]; default: 75
-c VALUE Critical level for RAM usage; default: 90
-s VALUE Critical level for SWAP usage; default: 50
-p VALUE show process info with highest memory consumption if
usage is > NN %; default: 50
-h or --help show this help.
PARAMETERS:
none
EXAMPLE:
check_memory -w 90 -c 95 -p 70
Examples
$ check_memory -w 90 -c 95 -p 70
returns
OK: RAM usage 46 % of 7955 MB (machine has no Swap)
MemTotal: 8146916 kB
MemFree: 901724 kB
MemAvailable: 4328748 kB
Buffers: 117988 kB
Cached: 3045292 kB
SwapCached: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Slab: 682424 kB
SReclaimable: 591596 kB
|memory-total=7955MB;;;0;7955 memory-used=3729MB;;;0;7955 memory-avail=4226MB;;;0;7955 memory-free=880MB;;;0;7955 memory-buffers=115MB;;;0;7955 memory-cached=2973MB;;;0;7955 memory-sreclaim=577MB;;;0;7955