Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Linux Ram & Swap memory
1.0.1
2013-06-01
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios XI
- Nagios Fusion
GPL
42043
File | Description |
---|---|
check_memory.sh | check_memory.sh |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
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
calculator.
Note: bc normally requires Glibc,ncurses-libs,readline.
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
calculator.
Note: bc normally requires Glibc,ncurses-libs,readline.
Reviews (1)
bymohanpn, October 29, 2018
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
ram_tot=1
fi
if [ $swap_tot -eq 0 ] then
swap_tot=1
fi
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
ram_tot=1
fi
if [ $swap_tot -eq 0 ] then
swap_tot=1
fi