nagios plugin: memory checks

Short of making my own, I googled for one and found this site: http://www.unixdaemon.net/nagios_plugins.html#check_linux_free_memory

The site contains a plugin that contains a nagios plugin that checks and displays basically the free(percentage and size in MB) amount of memory on your system. With “free” it means, from the contents of /proc/meminfo, free=MemFree + Cached. It’s pretty basic but it’s all that I need Discover More. Sample output:

[root@localhost libexec]# ./check_linux_free_memory.pl -w 20 -c 10
OK: 31% (156M) free memory.

Here’s another memory check plugin I found from this site: http://www.matejunkie.com/memory-check-plugin-for-nagios/

This plugin lets you choose between outputting data either by the percentage or in kilobytes, but not both. Although, with a little hacking you can use both for output. It parses data from /proc/meminfo and doesn’t add “Cached” to the value of the total free memory. Although checking the script, the “Cached” value is saved to the CACHE variable. Adding it to the total free memory shouldn’t be much trouble.

Sample output:

[root@localhost libexec]# ./check_mem -s perc -w 80 -c 90
CRITICAL – Used: 93%, Free: 7% | ‘mem_used’=93;80;90 ‘mem_free’=7

There’s like 130MB in my cached memory which wasn’t included in the computation of the output above, it wouldn’t have displayed a CRITICAL notice if it was included. They’re both ok and do what they’re supposed to do, I guess it’s just a matter of your own taste on which one would you prefer to use.

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

Security Code:

This site uses Akismet to reduce spam. Learn how your comment data is processed.