Reputation: 11
I am trying to generate a memory utilisation report for couple of Linux servers. I want to collect the % memory utilisation of servers for every 10 mins and I think sar can help to get that data. Earlier I though column %memused will directly give the % memory utilisation of the server. But after reading couple of articles I am suspecting that this not the correct memory utilisation of the server and therefore I want to know the best way to calculate the memory utilisation of the server.
Can anyone help me to calculate % memory utilisation of the server for every 10 mins using sar report or any other best to get the % memory utilisation.
06:39:47 PM kbmemfree kbmemused %memused kbbuffers kbcached kbcommit %commit
06:39:48 PM 616552 3307708 84.29 245368 2174816 1196772 24.07
06:39:49 PM 616552 3307708 84.29 245368 2174816 1196772 24.07
Upvotes: 0
Views: 5140
Reputation: 71
To calculate free memory value with SAR, use the below formula:
kbmemfree + kbbuffers + kbcached = actual free memory on the system
Using your example:
616552 + 245368 + 2174816 = 3036736KB
That’s around 2.89GB free memory.
I believe then you can subtract from total memory available to get the utilization.
Upvotes: 1
Reputation: 1042
The actual free memory on the system is free+buffers+cached. Buffers and cached are used to improve the system performance but will be returned to the free pool when needed.
If you are using a lot of shared memory (e.g mmaping a big cache) the calculation is slightly different and I use free
for that
xxx@xxx:$ free -h
total used free shared buff/cache available
Mem: 62G 4.4G 7.9G 11G 50G 45G
Swap: 2.0G 12M 1.9G
The free memory in this case is:
Upvotes: 0