Linux memory monitoring and slab?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Linux memory monitoring and slab?

Post by gormank »

Has anyone located a Linux memory monitor that adds the slab reclaimable RAM back so when slab doesn't free memory, there are no false alerts?
Personally I think a process that sucks up 200G RAM in a month, whether reclaimable or not is the problem, but that's me...
Last edited by gormank on Fri Jun 10, 2016 6:06 pm, edited 1 time in total.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Linux memory monitoring and slab?

Post by Box293 »

As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Linux memory monitoring and slab?

Post by gormank »

My memory check is as follows:

/usr/local/nagios/libexec/check_nrpe -H <host> -u -t 45 -c check_mem -a '-w 25 -c 10'

It and other memory checks don't add back the allocated but freeable RAM used by slab and will alert. I have no need to check slab usage itself.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Linux memory monitoring and slab?

Post by gormank »

Somewhat unrelated, but it looks like the check_mem plugin isn't always accurate. I'm not sure if its standard or not.

OK - 503843 / 257751 MB (195%) Free Memory, Used: 3550 MB, Shared: 4097 MB, Buffers: 253500 MB, Cached: 249642 MB

$ free
total used free shared buff/cache available
Mem: 263937608 3617244 739340 4196120 259581024 255652432
Swap: 33554428 28856 33525572

$ grep check_mem /usr/local/nagios/etc/nrpe.cfg
$ grep check_mem /usr/local/nagios/etc/nrpe/common.cfg
command[check_mem]=/usr/local/nagios/libexec/custom_check_mem -n $ARG1$

$ file /usr/local/nagios/libexec/custom_check_mem
/usr/local/nagios/libexec/custom_check_mem: Bourne-Again shell script, ASCII text executable

$ ll /usr/local/nagios/libexec/custom_check_mem
-rwxr-xr-x. 1 root root 3060 Nov 11 2015 /usr/local/nagios/libexec/custom_check_mem
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Linux memory monitoring and slab?

Post by tgriep »

The -n option adds in the cached memory back in to the formula which could account for the discrepancy.
Even the output of the free command doesn't look right.
263 gig total, 3.6 gig used, 739 meg free.
Be sure to check out our Knowledgebase for helpful articles and solutions!
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Linux memory monitoring and slab?

Post by gormank »

From what I've seen, that has no effect.

COMMAND: /usr/local/nagios/libexec/check_nrpe -H txslm2mlpxy003 -u -t 45 -c check_mem -a '-w 25 -c 10 -n'
OUTPUT: OK - 503866 / 257751 MB (195%) Free Memory, Used: 3554 MB, Shared: 4065 MB, Buffers: 253449 MB, Cached: 249669 MB | total=257751MB free=503866MB used=3554MB shared=4065 buffers=253449MB cached=249669MB

This is an RHEL 7.2 box and the output of free is different in 5 and 6 as well.

buff/cache is using the memory and its available for reuse.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Linux memory monitoring and slab?

Post by Box293 »

gormank wrote:This is an RHEL 7.2 box and the output of free is different in 5 and 6 as well.
Here's an updated version of the plugin that should fix these issues.
custom_check_mem.txt
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Linux memory monitoring and slab?

Post by gormank »

Thanks, but we've deviated from the original question (my fault).
In RHEL 6 and 7 at least if slab reclaimable is big, the memory monitor can alert when there's freeable memory.
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Linux memory monitoring and slab?

Post by Box293 »

I suspect you're going to need to write your own plugin to do this.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
gormank
Posts: 1114
Joined: Tue Dec 02, 2014 12:00 pm

Re: Linux memory monitoring and slab?

Post by gormank »

I already have, via /proc/meminfo, but I guess no one else has elasticsearch, or anything else on RHEL 6 or 7 that burns through RAM, or people just don't monitor memory.
Locked