Page 1 of 1

Memory Usage in RHEL instances

Posted: Tue Feb 16, 2016 11:39 am
by akepley
I need to understand how the memory usage service works in NagiosXI as we have a lot of servers that reach warning and critical levels when we have the service set to 20% and 10% respectively.

For instance, this server shows a `free -m` as follows:

Code: Select all

root@server1 nagios# free -m
             total       used       free     shared    buffers     cached
Mem:          3829       3577        251         35        479        438
-/+ buffers/cache:       2660       1168
Swap:            0          0          0
Since Linux uses all free memory it can for optimization, the free usage under Mem doesn't really give a good indication of what is really available for memory utilization. Even using the -n option doesn't seem to provide a real idea of what the virtual memory actually has to use if a program needs it. I would say that the 1168mb of free memory under buffers/cache would be the better number to use. Am I reading this wrong or is there an option I'm not providing to NagiosXI arguments to take into account the cache free value?

Code: Select all

COMMAND: /usr/local/nagios/libexec/check_nrpe -H 10.200.9.125 -t 30 -c check_mem -a '-w 20 -c 10 -n'
OUTPUT: WARNING - 676 / 3829 MB (17%) Free Memory, Used: 3591 MB, Shared: 35 MB, Buffers: 479 MB, Cached: 438 MB | total=3829MB free=676MB used=3591MB shared=35 buffers=479MB cached=438MB

Re: Memory Usage in RHEL instances

Posted: Tue Feb 16, 2016 3:05 pm
by hsmith
Unless I'm not understanding something correctly, that's still a pretty high amount of memory used.

From the man page for 'free':
used Used memory (calculated as total - free - buffers - cache)
free Unused memory (MemFree and SwapFree in /proc/meminfo)
buffers
Memory used by kernel buffers (Buffers in /proc/meminfo)

cache Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
I'm not sure if buffers/cache would be the right approach. I think the way it works right now is pretty proper.

Re: Memory Usage in RHEL instances

Posted: Tue Feb 16, 2016 4:56 pm
by akepley
See this documentation (https://access.redhat.com/documentation ... Cache.html) from Red Hat and this link (http://www.freelinuxconsole.info/unders ... nuxunix-2/) which provides a good writeup for what the actual memory available is on RHEL linux.

This appears to show that the cache line is the actual available memory and what we really need to keep up with. Is there an option to take this line into account or another memory check plugin that will use this line?

Re: Memory Usage in RHEL instances

Posted: Tue Feb 16, 2016 5:25 pm
by hsmith
It may be an issue because not every distro puts out that information the same way. I could see where it would be good to look at it, but if it's not provided the same across multiple distrobutions, that could be the reasoning.

Take a look at my Fedora 23 machine for instance:

Code: Select all

[root@potus ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:           7966         125        7578           0         262        7774
Swap:          3967           0        3967
versus my Debian Jessie VPS:

Code: Select all

             total       used       free     shared    buffers     cached
Mem:           494        482         12         12        205        112
-/+ buffers/cache:        164        330
Swap:            0          0          0


If you feel like something can be changed, please submit an issue/feature request here: https://github.com/nagios-plugins. Otherwise, this may be a favorable plugin for you: https://exchange.nagios.org/directory/P ... 29/details

Re: Memory Usage in RHEL instances

Posted: Tue Feb 16, 2016 5:31 pm
by akepley
Thanks we'll take a look!

Re: Memory Usage in RHEL instances

Posted: Wed Feb 17, 2016 11:25 am
by lmiltchev
Sounds good! We will keep the thread open for a while. Let us know if you have any more questions.