Home Directory Plugins Operating Systems Linux check physical 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

Login

Remember Me

Directory Tree

check physical memory

Rating
5 votes
Favoured:
1
Hits
179797
Files:
FileDescription
check_mem.txtcheck_mem
Nagios CSP

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!
Check physical memory using shell script. Memory is displayed as a percentage.
Quick and easy to implement, does not require any additional packages.

Usage: check_mem [-w|--warning] [-c|--critical]


example:

check_mem -w 10 -c 5

Gives WARNING on 10% free phsical memory and CRITICAL on 5% free memory
Reviews (4)
Hello all,
I have these errors when I try to implement the script on my server: Ubuntu 18 and Nagios 4.4.6

Website:
(No output on stdout) stderr: /usr/local/nagios/libexec/check_mem01.sh: 23: /usr/local/nagios/libexec/check_mem01.sh: [[: not found


Localhost -> Service
define service {
use local-service
host_name localhost
service_description Memory Usage
check_command check_memory!95%!97%
}
"If I change the last line by check_memory -w 10 -c 5 the system shows me:
'check_memory -w 10 -c 5' specified in service 'Memory Usage' for host 'localhost' not defined anywhere!


commands.cfg:
define command {
command_name check_memory
command_line $USER1$/check_mem01.sh -w -c
}

Thanks in advance!
I used Foncu method to get graph, but my graph is stuck on 3.96Kb, not able to get it to display proper values for the Memory Graph inside Nagios, what needs to change for it to display properly?
byfoncu, December 19, 2017
1 of 1 people found this review helpful
Good plugin, I added Perfdata for NagiosGraph replacing the final 3 IF by this code:

if [[ "$percent" -le $critical ]]; then
echo "CRITICAL - $free MB ($percent%) Free Memory | total=${total}MB used=${used}MB"
exit $STATE_CRITICAL
elif [[ "$percent" -le $warning ]]; then
echo "WARNING - $free MB ($percent%) Free Memory | total=${total}MB used=${used}MBÂș"
exit $STATE_WARNING
elif [[ "$percent" -gt $warning ]]; then
echo "OK - $free MB ($percent%) Free Memory | total=${total}MB used=${used}MB"
exit $STATE_OK
fi
byTasslehoff, March 16, 2012
1 of 1 people found this review helpful
Good plugin, on Windows I control paging and physical memory through scripts included into nscclient++, you script is a good way to do the same control on linux.

I made a couple of changes because I found more useful control busy memory without considering cache and buffers, so I changed used variable (lin 60) with this: used=`free -m | head -3 |tail -1 | gawk '{print $3}'`
I changed the free memory variable (line 62) with this: let free=$total-$used

Thanks again for plugin and for your time :)