Take the 2-minute tour ×

Searching for Nagios plugins that checks for memory usage on gives a lot of results, so it is hard to know which to use, as the Nagios plugin package doesn't contain a plugin for checking memory.

So I was wondering, which others are using?

I am using NRPE with Nagios on Linux for Linux hosts.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

I disagree strongly with Glen M - the amount of memory available for cache and buffers is essential to ensuring good performance on nearly every type of application on nearly every type of server OS.

If you wait until your webserver starts paging before you know about the problem then it's much too late.

On a handy workstation, I can see this:

             total       used       free     shared    buffers     cached
Mem:       4135700    2588568    1547132          0      91024    2309052
-/+ buffers/cache:     188492    3947208
Swap:      4192944        156    4192788

I'd want to report usage as 100*[used-buffers/cache]/total, or 100*188492/4135700.

Writing a plugin for this is not exactly taxing. But there are several offerings available which cover this - e.g. check_mem.pl

To build your own, here's a wee hint:

PCTUSED=`free | awk '/^Mem:/ {tot=$2; } /buffers/ { used=$3; } END { print used*100/tot }'`
share|improve this answer

A few years back, I wrote a plugin for this.

Fundamentally, most OS' memory reports are a bit faulty-- stuff is held by applications but can be released at any given time if needed.

What you probably really care about is how often your system has to go to the disk for swap-- i.e., if it starts thrashing.

I used vmstat and some regex (or maybe python with regex) to look at the pages in and pages out, and to see if they passed a certain threshhold.

This took rather a bit of tuning and monitoring, but this is what I best used. It's not difficult to write plugins for {nagios | big brother | xymon | mon}

share|improve this answer

Your Answer


