Page 1 of 1

ncpa agent |memory

Posted: Tue Jun 11, 2019 11:53 am
by progressive.nagiosXI
Hi ,

we want to know how NCPAagent calculate memory in Linux.

is Available memory value calculated via any formula or value taken directly from ( cat /proc/meminfo ) command.As some OS doesn't show available memory in free -h command.

we want to know because NCPA agent does not show buffered/cache/shared in summary of memory alert.So we need to describe how the things (formula/calculation) working in NCPA background to clients.

Thanks

Re: ncpa agent |memory

Posted: Tue Jun 11, 2019 1:16 pm
by benjaminsmith
Hi,

NCPA uses the popular psutil module for python to gather virtual and swap memory data. You can find the documentation for psutil memory function on this page:

https://psutil.readthedocs.io/en/latest ... -functions

Also, scanning the source code, it does look like it's using the /proc/meminfo virtual file to determine values.
https://github.com/giampaolo/psutil/blo ... pslinux.py

Let me know if that helps you explain the functionality for your clients.

Re: ncpa agent |memory

Posted: Wed Jun 12, 2019 12:32 pm
by progressive.nagiosXI
Hi,

actually we want to know

available memory=free + cached+ buffers

but in suse linux this concept looks not working ,Please check attachment (Server memory command + Nagios Critical summary)

Total memory=15GB
buffer/cache is 10 GB free then why memory show in critical state.

Note:- currently we monitor via NCPA

we think nagios taking Available memory detail from /proc/meminfo and compare threshold value as per configuration.

Please help to understand here.

Thanks

Re: ncpa agent |memory

Posted: Wed Jun 12, 2019 2:34 pm
by lmiltchev
NCPA uses psutils, and we cannot change what metrics are available, and how they are calculated. You could monitor various types of memory via NCPA, e.g. total, free, used, and available but there is no way to include/exclude cached memory & buffers "out of the box". You would have to write your own, custom plugin in order to do that.

Here's an example of some of the NCPA memory checks, and the output of the "free -m" command:

Code: Select all

[root@main-nagios-xi libexec]# ./check_ncpa.py -H x.x.x.x -t 'mytoken' -M 'memory/virtual/total' -u Mi
OK: Total was 3961.26 MiB | 'total'=3961.26MiB;;;
[root@main-nagios-xi libexec]# ./check_ncpa.py -H x.x.x.x -t 'mytoken' -M 'memory/virtual/free' -u Mi
OK: Free was 3536.05 MiB | 'free'=3536.05MiB;;;
[root@main-nagios-xi libexec]# ./check_ncpa.py -H x.x.x.x -t 'mytoken' -M 'memory/virtual/available' -u Mi
OK: Available was 3802.49 MiB | 'available'=3802.49MiB;;;
[root@main-nagios-xi libexec]# ./check_ncpa.py -H x.x.x.x -t 'mytoken' -M 'memory/virtual/used' -u Mi
OK: Used was 128.96 MiB | 'used'=128.96MiB;;;


linux-aa2t:/usr/local/nagios/libexec # free -m
             total       used       free     shared    buffers     cached
Mem:          3962        425       3537          0         50        245
-/+ buffers/cache:        129       3833
Swap:         2053          0       2053