Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Check UNIX Memory Usage
0.4b
2011-03-23
- Nagios 3.x
GPL
120688
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 plugin checks system memory, program memory, caché memory and swap usage values in UNIX-like operating systems supporting /proc filesystem.
Memory check can be done based on ranges or thresholds using as units bytes, kilobytes, Megabytes, Gigabytes and Terabytes. Additionally memory usage can be checked as percent based on the overall system consumption.
Plugin is Nagios 3.x (ePN) compatible an returns memory usage as performance data. Included README file includes plugin related information.
CHANGES
- The plugin provides two new features for added versatility and flexibility:
+ By an argument you can specify whether you want to get a metric, in the
performance data, with the maximum RAM in the system. This allows the
graphics have always drawn the maximum RAM on top.
+ There is a new argument that lets you set the alert and criticality
thresholds in percentages, regardless of the chosen units for data output.
- Changed status estimation based memory cache whatever the unit fixed. The percentage of disk cache is estimated based on the value of MemTotal, available from /proc/meminfo.
- Now, you can select the levels of memory to check.
- Bug Fixes
+ Bug by illegal division by zero fixed. This ocurred when one of the memory total values was zero. Found by José Renato Attab Braga.
+ Fixed bad behavior by wich it was calculated correctly the percentage of use only when the unit was KiB.
- Changed status estimation based memory cache when the unit was percentage. In that case not be taken into account the cache value of cache because you can not get the total cache available from /proc/meminfo.
USAGE EXAMPLES
- Normal use:
check_unix_mem_usage.pl -u MiB -w 900,800,400,700 -c 1000,900,500,800
Output:
MEM_USAGE CRITICAL - Memory usage: 937.71MiB (93.55%) of 1002.40MiB (warning threshold is set to 900MiB), Application memory usage: 210.57MiB (22.11%) of 952.28MiB, Cache usage: 688.96MiB (68.73%) of 1002.40MiB (critical threshold is set to 500MiB), Swap usage: 0.00MiB (0.00%) of 894.99MiB | MemUsed=983260200.96B;943718400;1048576000;0;1051095040 AppMemUsed=220798648.32B;838860800;943718400;0;998540288 CacheUsed=722426920.96B;419430400;524288000;0;1051095040 SwapUsed=0B;734003200;838860800;0;938467328
It returns WARNING if memory usage is higher than 900MiB or if application memory usage is higher than 800MiB or if cache usage is higher than 400MiB or if used swap is higher than 700MiB and CRITICAL if memory usage is higher than 1000MiB or if application memory usage is higher than 900MiB or if cache usage is higher than 500MiB or if used swap is higher than 800MiB.
In other cases it returns OK if check has been performed succesfully.
- Selective use:
check_unix_mem_usage.pl -u MiB -w 900,800,, -c 1000,900,,
Output:
MEM_USAGE WARNING - Memory usage: 937.83MiB (93.56%) of 1002.40MiB (warning threshold is set to 900MiB), Application memory usage: 210.68MiB (22.12%) of 952.28MiB | MemUsed=983386030.08B;943718400;1048576000;0;1051095040 AppMemUsed=220913991.68B;838860800;943718400;0;998540288
It returns WARNING if memory usage is higher than 900MiB or if application memory usage is higher than 800MiB and CRITICAL if memory usage is higher than 1000MiB or if application memory usage is higher than 900MiB.
In other cases it returns OK if check has been performed succesfully.
Note: thresholds of both WARNING and CRITICAL must be passed in the chosen units.
- Output in unit choosen and checks in percentages:
check_unix_mem_usage.pl -u MiB -m -p -w 80,80,,80 -c 90,90,,90
Output:
MEM_USAGE CRITICAL - Memory usage: 937.83MiB (93.56%) of 1002.40MiB (critical threshold is set to 902.162109375MiB), Application memory usage: 210.67MiB (22.12%) of 952.28MiB, Swap usage: 0.00MiB (0.00%) of 894.99MiB | MemUsed=983386030.08B;840876032;945985536;0;1051095040 AppMemUsed=220903505.92B;798832230.4;898686259.2;0;998540288 SwapUsed=0B;750773862.4;844620595.2;0;938467328 MaxRam=1051095040B
It returns WARNING if memory usage or if application memory usage or if swap are higher than 80% and CRITICAL if memory usage or if application memory usage or if swap are higher than 90%.
In other cases it returns OK if check has been performed succesfully.
Note: thresholds of both WARNING and CRITICAL must be passed in percentage. And note that the cache has not been checked.
Memory check can be done based on ranges or thresholds using as units bytes, kilobytes, Megabytes, Gigabytes and Terabytes. Additionally memory usage can be checked as percent based on the overall system consumption.
Plugin is Nagios 3.x (ePN) compatible an returns memory usage as performance data. Included README file includes plugin related information.
CHANGES
- The plugin provides two new features for added versatility and flexibility:
+ By an argument you can specify whether you want to get a metric, in the
performance data, with the maximum RAM in the system. This allows the
graphics have always drawn the maximum RAM on top.
+ There is a new argument that lets you set the alert and criticality
thresholds in percentages, regardless of the chosen units for data output.
- Changed status estimation based memory cache whatever the unit fixed. The percentage of disk cache is estimated based on the value of MemTotal, available from /proc/meminfo.
- Now, you can select the levels of memory to check.
- Bug Fixes
+ Bug by illegal division by zero fixed. This ocurred when one of the memory total values was zero. Found by José Renato Attab Braga.
+ Fixed bad behavior by wich it was calculated correctly the percentage of use only when the unit was KiB.
- Changed status estimation based memory cache when the unit was percentage. In that case not be taken into account the cache value of cache because you can not get the total cache available from /proc/meminfo.
USAGE EXAMPLES
- Normal use:
check_unix_mem_usage.pl -u MiB -w 900,800,400,700 -c 1000,900,500,800
Output:
MEM_USAGE CRITICAL - Memory usage: 937.71MiB (93.55%) of 1002.40MiB (warning threshold is set to 900MiB), Application memory usage: 210.57MiB (22.11%) of 952.28MiB, Cache usage: 688.96MiB (68.73%) of 1002.40MiB (critical threshold is set to 500MiB), Swap usage: 0.00MiB (0.00%) of 894.99MiB | MemUsed=983260200.96B;943718400;1048576000;0;1051095040 AppMemUsed=220798648.32B;838860800;943718400;0;998540288 CacheUsed=722426920.96B;419430400;524288000;0;1051095040 SwapUsed=0B;734003200;838860800;0;938467328
It returns WARNING if memory usage is higher than 900MiB or if application memory usage is higher than 800MiB or if cache usage is higher than 400MiB or if used swap is higher than 700MiB and CRITICAL if memory usage is higher than 1000MiB or if application memory usage is higher than 900MiB or if cache usage is higher than 500MiB or if used swap is higher than 800MiB.
In other cases it returns OK if check has been performed succesfully.
- Selective use:
check_unix_mem_usage.pl -u MiB -w 900,800,, -c 1000,900,,
Output:
MEM_USAGE WARNING - Memory usage: 937.83MiB (93.56%) of 1002.40MiB (warning threshold is set to 900MiB), Application memory usage: 210.68MiB (22.12%) of 952.28MiB | MemUsed=983386030.08B;943718400;1048576000;0;1051095040 AppMemUsed=220913991.68B;838860800;943718400;0;998540288
It returns WARNING if memory usage is higher than 900MiB or if application memory usage is higher than 800MiB and CRITICAL if memory usage is higher than 1000MiB or if application memory usage is higher than 900MiB.
In other cases it returns OK if check has been performed succesfully.
Note: thresholds of both WARNING and CRITICAL must be passed in the chosen units.
- Output in unit choosen and checks in percentages:
check_unix_mem_usage.pl -u MiB -m -p -w 80,80,,80 -c 90,90,,90
Output:
MEM_USAGE CRITICAL - Memory usage: 937.83MiB (93.56%) of 1002.40MiB (critical threshold is set to 902.162109375MiB), Application memory usage: 210.67MiB (22.12%) of 952.28MiB, Swap usage: 0.00MiB (0.00%) of 894.99MiB | MemUsed=983386030.08B;840876032;945985536;0;1051095040 AppMemUsed=220903505.92B;798832230.4;898686259.2;0;998540288 SwapUsed=0B;750773862.4;844620595.2;0;938467328 MaxRam=1051095040B
It returns WARNING if memory usage or if application memory usage or if swap are higher than 80% and CRITICAL if memory usage or if application memory usage or if swap are higher than 90%.
In other cases it returns OK if check has been performed succesfully.
Note: thresholds of both WARNING and CRITICAL must be passed in percentage. And note that the cache has not been checked.
Reviews (1)
I just copied the check_unix_mem_usage.pl into my nagios libexec folder.
/usr/local/nagios/libexec/
And when I try to run the plugin locally and check the output it gives me only the following line.
I ran the command as follows:
/usr/local/nagios/libexec/check_unix_mem_usage.pl
And the output was :
Setuid/gid script is writable by world.
Please help me to get this done.
Thanks.
/usr/local/nagios/libexec/
And when I try to run the plugin locally and check the output it gives me only the following line.
I ran the command as follows:
/usr/local/nagios/libexec/check_unix_mem_usage.pl
And the output was :
Setuid/gid script is writable by world.
Please help me to get this done.
Thanks.
Owner's reply
Hi ccdwelivita: it seems that you've set the setuid flag in order to run the script with the owner permissions while you grant all users write permissions. It's not a matter of the plugin itself but the permissions that you've set.