Hi, wanted to get more information on how to get the real used memory value on a droplet with CentOS 7 x64.
I was reviewing how DigitalOcean calculates used memory in the monitoring graphs and they do it “used memory is calculated by subtracting free memory and memory used for caching from the total memory amount” from the information exposed in /proc/meminfo
.
This is the correct way to calculate used memory on a Linux server?
I see other people calculating used memory as “dividing active memory by total memory amount” from the same information exposed in /proc/meminfo
.
Any ideas on this? What do you think? As you can see I have little knowledge on this issue.
Thank you.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello
It seems you want to figure out the used memory rate.About
/proc/meminfo
you should know: this is not a real file. Instead,/proc/meminfo
is a dummy file containing real-time dynamic information about the system. In particular, you need to check the following values: Total memory (MemTotal) Free memory (MemFree) Available memory (MemAvailable) Buffers File cache (Cached) SwapCached All swap areas (SwapTotal) SwapFree If you want to use/proc/meminfo
, you can connect to the egrep command and use it:egrep --color'Mem | Cache | Swap'/proc/meminfo
.This will produce an easy-to-read list with entries containing things like Mem, Cache and Swap will be colored.Other commands to find that,
top
,free
,vmstat -s
anddmidecode
may help you.But to use dmidecode command,you need to have sudo permission,then type insudo dmidecode -t 17
.The output of this command can be long because it displays information for all memory-type devices. Therefore, if you cannot scroll up and down, you may need to send the output of this command to a file,likesudo dmidecode -t 17> dmi_infoI
or pass it to aless
command, such assudo dmidecode | less
.By the way,how do you export the red font?
Best wishes.
Shiroka
This is the /proc/meminfo output: