Linux – Free / Cached / Available memory on Linux

cachelinuxmemorymemory usage

I have read that linux uses free memory for caching, to make system faster. However, both Nagios and Paessler PRTG monitoring system show me that my memory usage is critical.

I could change Nagios mem_usage script to sum free and cached memory, but would that be correct information? I doubt that they misunderstood Linux memory usage.

Lets say I have 8 GB RAM. 5 GB are used, 2 GB is cached, and I have 1 GB of free memory. Real available memory should be free+cached (3 GB)? If some new application would need additional 3 GB RAM, could it take everything from cache and free without using swap, or is there a minimum that should be in cache?

Real example:

$ cat /proc/meminfo
MemTotal:        5984256 kB
MemFree:          137052 kB
Buffers:          140484 kB
Cached:          3439616 kB
SwapCached:          244 kB
Active:          3148824 kB
Inactive:        2341768 kB
...

My monitoring tools show that I have 137 MB free RAM, however I have ~3,5 GB in Cache.

Thanks!

Best Answer

I had the same experience in Nagios when I used the check_mem.pl plugin. When you define the tress hold for critical, you need to use a capital C instead of a normal c.

Like this:

command[check_mem]=/usr/lib/nagios/plugins/check_mem -w 10 -C 5 -f

Then it takes the cached memory in account and it will not send warnings.