Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check physical memory
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
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)
byKleri, July 28, 2021
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 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!
bygeorged, October 9, 2018
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?
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
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
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 :)
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 :)