Home Directory Plugins Operating Systems Linux Linux Ram & Swap memory

Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com


Remember Me

Directory Tree

Linux Ram & Swap memory

Current Version
Last Release Date
Compatible With
  • Nagios 1.x
  • Nagios 2.x
  • Nagios 3.x
  • Nagios XI
  • Nagios Fusion
Network Monitoring Software - Download Nagios XI
Log Management Software - Nagios Log Server - Download
Netflow Analysis Software - Nagios Network Analyzer - Download
Simple shell script that checks for Ram (- buffers/cache) and Swap memory at the same time comparing them with the specified thresholds.
This simple but useful plugin is a bash shell script that collects information about the free and
used Ram and Swap memory on a Linux box and calculates the relative (percent) values for each.
It then compares the two percent values with the two thresholds specified as parameters alerting
with a "Warning" state if at least one of the values exceeds the related threshold or with a "Critical" state
if both the values exceed them.
The relative values for free and used Ram memory are calculated on the base of the memory actaully used by
the system itself and by the applications i.e. without the portion of Ram dedicated to the disk I/O blocks (buffers)
and to page cache (cache) or shorthly, without the portion of Ram that the system can purge and flush in response of
memory pressure.
The script makes use of 'bc' , that extends the bash shell capabilities to a full floating point/arbitrary precision
Note: bc normally requires Glibc,ncurses-libs,readline.
Reviews (1)
Thank you for such a simple script that can make the life easy.

Just observed that at times one may face ZERO DIVIDE error (in case SWAP is ZERO).
So added minor check in the script to get over that error.

if [ $ram_tot -eq 0 ] then

if [ $swap_tot -eq 0 ] then