Home » Categories » General Topics » Check Library

Memory Checks

Memory Checks

Memory checks vary depending on the following factors:

It is common for memory checks to be a combination of physical memory + swap/page. If the check supports checking the physical memory separately then an example will be provided for that as well.

The sections below provide examples of how to perform these checks using different methods.

 

Memory Free - Percentage

These are memory free checks based on percentages, they are best used when you want to be notified if the amount of free memory is running out.

 

Nagios Plugins

Nagios Plugins does not include a memory plugin however the linux-nrpe-agent does provide custom_check_mem. The thresholds for the plugin are triggered if the free memory is less than the supplied value.

Unit: %
Warning: 20% Free
Critical: 10% Free

Command:

./custom_check_mem -w 20 -c 10

Output:

OK - 1517 / 1893 MB (80%) Free Memory, Used: 375 MB, Shared: 0 MB, Buffers: 122 MB, Cached: 189 MB | total=1893MB free=1517MB used=375MB shared=0MB buffers=122MB cached=189MB

 

If you do not want the cached memory to be part of the thresholds calculations the -n argument is used:

Command:

./custom_check_mem -w 20 -c 10 -n

Output:

OK - 1706 / 1893 MB (90%) Free Memory, Used: 375 MB, Shared: 0 MB, Buffers: 122 MB, Cached: 189 MB | total=1893MB free=1706MB used=375MB shared=0MB buffers=122MB cached=189MB

NCPA

NPCA includes a memory module however it only reports on used memory for percentages, please see the Memory Used - Percentage section.

If you wanted a free memory check then you will need to specify a value as demonstrated in the Memory Free - Specific Value section.

NSClient++ via check_nt

NSClient++ includes a memory module. The checks only support percentage values for used memory.

NSClient++ via check_nrpe

NSClient++ includes a memory module. The thresholds for the memory checks are triggered if the free memory is less than the supplied value.

Unit: %
Warning: 20% Free
Critical: 10% Free

Command:

./check_nrpe -H 10.25.14.10 -c check_memory -a 'warn=free<20%' 'crit=free<10%'

Output:

OK: committed = 2.314GB, physical = 2.089GB|'committed'=4.68562GB;1.39991;0.69995;0;6.99956 'committed %'=66%;19;9;0;100 'physical'=3.91086GB;1.19991;0.59995;0;5.99956 'physical %'=65%;19;9;0;100

 

To only check the physical memory the type= argument can be used:

Command:

./check_nrpe -H 10.25.14.10 -c check_memory -a type=physical 'warn=free<20%' 'crit=free<10%'

Output:

OK: physical = 2.101GB|'physical'=3.89902GB;1.19991;0.59995;0;5.99956 'physical %'=64%;19;9;0;100

WMI

Check WMI Plus includes a memory module. Using the Nagios Plugin Threshold standards, the thresholds are triggered if the free memory is less than the supplied value.

Unit: %
Warning: 20% Free
Critical: 10% Free

Command:

./check_wmi_plus.pl -H 10.25.14.3 -u wmiagent -p Str0ngP@ssw0rd -m checkmem -w '_MemFree%=20:' -c '_MemFree%=10:'

Output:

OK - Physical Memory: Total: 1,023.492MB - Used: 483.531MB (47%) - Free: 539.961MB (53%)|'Physical Memory Used'=507019264Bytes; 'Physical Memory Utilisation'=47%;

SNMP

The check_snmp_storage_wizard.pl plugin allows you to target physical memory using SNMP and regular expressions. The thresholds for the memory checks are triggered if the free memory is less than the supplied value.

Unit: %
Warning: 10% Free
Critical: 5% Free

Command:

./check_snmp_storage_wizard.pl -H 10.25.13.15 -C public --v2c -m "Physical" -T pl -w 10 -c 5 -f

Output:

Physical memory: 79%left(1450MB/1840MB) (>10%) : OK | 'Physical_memory'=390MB;1656;1748;0;1840

 

 

Memory Free - Specific Value

These are memory free checks based on specific values, they are best used when you want to be notified if the amount of free memory is running out.

 

Nagios Plugins

Nagios Plugins does not include a memory plugin however the linux-nrpe-agent does provide custom_check_mem. The checks only support percentage values for free memory.

NCPA

NPCA includes a memory module. Using the Nagios Plugin Threshold standards, the thresholds are triggered if the free memory is less than the supplied value.

Unit: GB
Warning: 4GB Free
Critical: 2GB Free

Command:

./check_ncpa.py -H 10.25.254.50 -t Str0ngT0k3n -M memory/virtual/free -u G -w 4: -c 2:

Output:

OK: Free was 10.66 GB | 'free'=10.66GB;4:;2:;

NSClient++ via check_nt

NSClient++ includes a memory module. The checks only support percentage values for used memory.

NSClient++ via check_nrpe

NSClient++ includes a memory module. The thresholds for the memory checks are triggered if the free memory is less than the supplied value.

Unit: GB
Warning: 4GB Free
Critical: 2GB Free

Command:

./check_nrpe -H 10.25.14.10 -c check_memory -a 'warn=free<4G' 'crit=free<2G'

Output:

WARNING: committed = 2.315GB, physical = 2.092GB|'committed'=4.68453GB;4;2;0;6.99956 'committed %'=66%;57;28;0;100 'physical'=3.90794GB;4;2;0;5.99956 'physical %'=65%;66;33;0;100

 

To only check the physical memory the type= argument can be used:

Command:

./check_nrpe -H 10.25.14.10 -c check_memory -a type=physical 'warn=free<4G' 'crit=free<2G'

Output:

WARNING: physical = 2.217GB|'physical'=3.78282GB;4;2;0;5.99956 'physical %'=63%;66;33;0;100

WMI

Check WMI Plus includes a memory module. Using the Nagios Plugin Threshold standards, the thresholds are triggered if the free memory is less than the supplied value.

Unit: GB
Warning: 4GB Free (must be expressed as 4000000000 bytes)
Critical: 2GB Free (must be expressed as 2000000000 bytes)

Command:

./check_wmi_plus.pl -H 10.25.14.3 -u wmiagent -p Str0ngP@ssw0rd -m checkmem -w '_MemFree=4000000000:' -c '_MemFree=2000000000:'

Output:

CRITICAL - [Triggered by _MemFree<2000000000] - Physical Memory: Total: 1,023.492MB - Used: 483.527MB (47%) - Free: 539.965MB (53%)|'Physical Memory Used'=507015168Bytes; 'Physical Memory Utilisation'=47%;

SNMP

The check_snmp_storage_wizard.pl plugin allows you to target physical memory using SNMP and regular expressions. The thresholds for the memory checks are triggered if the free memory is less than the supplied value.

Unit: MB
Warning: 4GB Free (must be expressed as 4000 MB)
Critical: 2GB Free (must be expressed as 2000 MB)

Command:

./check_snmp_storage_wizard.pl -H 10.25.13.15 -C public --v2c -m "Physical" -T bl -w 4000 -c 2000 -f

Output:

Physical memory: 1450MBleft/1840MB (79%) (<2000MB) : CRITICAL | 'Physical_memory'=390MB;-2160;-160;0;1840

 

 

Memory Used - Percentage

These are memory usage checks based on percentages, they are best used when you want to be notified if the amount of used memory exceeds a threshold.

 

Nagios Plugins

The check_disk plugin is part of Nagios Plugins. Checks on Percentage Used are not possible with the plugin, you will need to perform a memory free check instead.

NCPA

NPCA includes a memory module. The thresholds are triggered if the used memory is greater than the supplied value.

Unit: %
Warning: 90% Used
Critical: 95% Used

Command:

./check_ncpa.py -H 10.25.254.50 -t Str0ngT0k3n -M memory/virtual/percent -w 90 -c 95

Output:

OK: Percent was 25.20 % | 'percent'=25.20%;90;95;

NSClient++ via check_nt

NSClient++ includes a memory module. The thresholds for the memory checks are triggered if the used memory is greater than the supplied value.

Unit: %
Warning: 90% Used
Critical: 95% Used

Command:

./check_nt -H 10.25.14.10 -p 12489 -s 'Str0ngP@ssw0rd' -v MEMUSE -w 90 -c 95

Output:

Memory usage: total:7167.61 MB - used: 2372.04 MB (33%) - free: 4795.58 MB (67%) | 'Memory usage'=2372.04MB;6450.85;6809.23;0.00;7167.61

NSClient++ via check_nrpe

NSClient++ includes a memory module. The thresholds for the memory checks are triggered if the used memory is greater than the supplied value.

Unit: %
Warning: 90% Used
Critical: 95% Used

Command:

./check_nrpe -H 10.25.14.10 -c check_memory -a 'warn=used>90%' 'crit=used>95%'

Output:

OK: committed = 2.391GB, physical = 2.21GB|'committed'=2.39108GB;6.2996;6.64958;0;6.99956 'committed %'=34%;89;94;0;100 'physical'=2.21012GB;5.3996;5.69958;0;5.99956 'physical %'=36%;89;94;0;100

 

To only check the physical memory the type= argument can be used:

Command:

./check_nrpe -H 10.25.14.10 -c check_memory -a type=physical 'warn=used>90%' 'crit=used>95%'

Output:

OK: physical = 2.211GB|'physical'=2.21104GB;5.3996;5.69958;0;5.99956 'physical %'=36%;89;94;0;100

WMI

Check WMI Plus includes a memory module. The thresholds are triggered if the used memory is greater than the supplied value.

Unit: %
Warning: 90% Used
Critical: 95% Used

Command:

./check_wmi_plus.pl -H 10.25.14.3 -u wmiagent -p Str0ngP@ssw0rd -m checkmem -w '_MemUsed%=90' -c '_MemUsed%=95'

Output:

OK - Physical Memory: Total: 1,023.492MB - Used: 484.043MB (47%) - Free: 539.449MB (53%)|'Physical Memory Used'=507555840Bytes; 'Physical Memory Utilisation'=47%;90;95;

SNMP

The check_snmp_storage_wizard.pl plugin allows you to target physical memory using SNMP and regular expressions. The thresholds for the memory checks are triggered if the used memory is greater than the supplied value.

Unit: %
Warning: 90% Used
Critical: 95% Used

Command:

./check_snmp_storage_wizard.pl -H 10.25.13.15 -C public --v2c -m "Physical" -T pu -w 90 -c 95 -f

Output:

Physical memory: 21%used(390MB/1840MB) (<90%) : OK | 'Physical_memory'=390MB;1656;1748;0;1840

 

 

Memory Used - Specific Value

These are memory usage checks based on a specific value, they are best used when you want to be notified if the amount of used memory exceeds a threshold.

 

Nagios Plugins

The check_disk plugin is part of Nagios Plugins. Checks on Used amount are not possible with the plugin, you will need to perform a memory free check instead.

NCPA

NPCA includes a memory module. The thresholds are triggered if the used memory is greater than the supplied value.

Unit: GB
Warning: 8GB Used
Critical: 16GB Used

Command:

./check_ncpa.py -H 10.25.254.50 -t Str0ngT0k3n -M memory/virtual/used -u G -w 8 -c 16

Output:

OK: Used was 3.25 GB | 'used'=3.25GB;8;16;

NSClient++ via check_nt

NSClient++ includes a memory module. The checks only support percentage values for used memory space.

NSClient++ via check_nrpe

NSClient++ includes a memory module. The thresholds for the memory checks are triggered if the used memory is greater than the supplied value.

Unit: GB
Warning: 8GB Used
Critical: 16GB Used

Command:

./check_nrpe -H 10.25.14.10 -c check_memory -a 'warn=used>8G' 'crit=used>16G'

Output:

OK: committed = 2.39GB, physical = 2.211GB|'committed'=2.38975GB;8;16;0;6.99956 'committed %'=34%;114;228;0;100 'physical'=2.21126GB;8;16;0;5.99956 'physical %'=36%;133;266;0;100

 

To only check the physical memory the type= argument can be used:

Command:

./check_nrpe -H 10.25.14.10 -c check_memory -a type=physical 'warn=used>8G' 'crit=used>16G'

Output:

OK: physical = 2.211GB|'physical'=2.21138GB;8;16;0;5.99956 'physical %'=36%;133;266;0;100

WMI

Check WMI Plus includes a memory module. The thresholds are triggered if the used memory is greater than the supplied value.

Unit: GB
Warning: 8GB Used (must be expressed as 8000000000 bytes)
Critical: 16GB Used (must be expressed as 16000000000 bytes)

Command:

./check_wmi_plus.pl -H 10.25.14.3 -u wmiagent -p Str0ngP@ssw0rd -m checkmem -w '_MemUsed=8000000000' -c '_MemUsed=16000000000'

Output:

OK - Physical Memory: Total: 1,023.492MB - Used: 484.129MB (47%) - Free: 539.363MB (53%)|'Physical Memory Used'=507645952Bytes;8000000000;16000000000; 'Physical Memory Utilisation'=47%;

SNMP

The check_snmp_storage_wizard.pl plugin allows you to target physical memory using SNMP and regular expressions. The thresholds for the memory checks are triggered if the used memory is greater than the supplied value.

Unit: MB
Warning: 8GB Used (must be expressed as 8000 MB)
Critical: 16GB Used (must be expressed as 16000 MB)

Command:

./check_snmp_storage_wizard.pl -H 10.25.13.15 -C public --v2c -m "Physical" -T bu -w 8000 -c 16000 -f

Output:

Physical memory: 390MBused/1840MB (21%) (<8000MB) : OK | 'Physical_memory'=390MB;8000;16000;0;1840

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Load Checks
Viewed 128 times since Thu, Nov 9, 2017
Network Interface Checks
Viewed 102 times since Mon, Nov 20, 2017
CPU Usage Checks
Viewed 93 times since Sun, Nov 12, 2017
Performance Counter Checks
Viewed 126 times since Wed, Nov 15, 2017
Disk Space Checks
Viewed 182 times since Thu, Nov 9, 2017
Service Checks
Viewed 67 times since Tue, Nov 14, 2017
Process Checks
Viewed 42 times since Thu, Nov 23, 2017
Agent Checks
Viewed 134 times since Tue, Nov 14, 2017
Operating System Checks
Viewed 163 times since Tue, Nov 14, 2017