Page 1 of 1

How does NCPA compute swap use

Posted: Fri Oct 11, 2019 8:42 am
by jenstar13
Hi,
My bosses want to know how NCPA gets it's figures for swap because it alerts too many times when it is not really used up
I tried to reverse engineer it
can you give me the commands you use to compute swap
example right now it says swap is at 100 % on a machine , that they say is a false alarm

We use the standard check
/usr/local/nagios/libexec/check_ncpa.py -H pupmas01 -t 'radial' -P 5693 -M memory/swap -u Gi -w 90 -c 95
CRITICAL: Used swap was 100.00 % (Total: 1.13 GiB, Used: 1.13 GiB, Free: 0.00 GiB) | 'total'=1.13GiB;90;95; 'used'=1.13GiB;90;95; 'free'=0.00GiB;90;95;

{
"memory": {
"swap": {
"total": [
378540032,
"B"
],
"percent": [
100.0,
"%"
],
"free": [
0,
"B"
],
"used": [
378535936,
"B"
]
},
"virtual": {
"available": [
1485025280,
"B"
],
"total": [
12161556480,
"B"
],
"percent": [
87.8,
"%"
],
"free": [
719921152,
"B"
],
"used": [
9951240192,
"B"
]
}
}
}

Re: How does NCPA compute swap use

Posted: Fri Oct 11, 2019 10:34 am
by benjaminsmith
Hello @jenstar13,

NCPA uses the python module psutil to fetch system info for memory checks. You can view the documentation here:

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

Try running the check command again and compare the results of the free command. Also, take a look at this blog post for some background on comparing the results.

How Do NCPA Memory Stats and Linux Utility Free Stack Up?

Re: How does NCPA compute swap use

Posted: Mon Oct 14, 2019 5:22 am
by jenstar13
ok, thank you, i will use those docs, you can close this
thank you
Jen