Using sar command results in wrong memory statistics on Fedora 22

1.6k views Asked by At

I'm trying to monitor a few servers by gathering various information with sar. All the systems which should be monitored are currently running Fedora 22. Unfortunately, I'm not able to get correct memory readings.

> free: total used free shared buff/cache available Mem: 1017260 34788 150984 68 831488 816204 Swap: 524284 20960 503324

> sar -r 1: kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit kbactive kbinact kbdirty 150996 866264 85.16 40 60784 169524 11.00 39572 31068 164

How does sar come up with those numbers? kbmemfree seems alright and kbmemused also makes sense if you add used and buff/cache from free together. But kbbuffers and kbcached look way off - my assumption is kbmemused - kbbuffers - kbcached = used (output of free), but that doesn't match up.

Am I doing something wrong? I'm struggling with that issue since two days now and wasn't able to find any further information.

1

There are 1 answers

0
jtaylor On BEST ANSWER

free from the procps tools seems to add Slab: from /proc/meminfo to its cached output. See proc/sysinfo.c kb_main_cached

So to get the equivalent output from sar you have add kbcached and kbslab from sar -r ALL 1 together.