Hi,
you have asked a brilliant question. As you are more familiar with the server log checking, you would understand this. First of all, you have to understand that when writing code for any plugin, I have to use some data which can be available on all Linux server. I know there are a lot of tools to check these data but the thing is most of them needs to be separately installed and also as the server OS can be any Linux based distros, I cannot simply rely on a simple command. So, I use the data from /proc/meminfo which can be found in all Linux based server.
Now, this file does not actually show the amount of RAM being used, but it does show the total RAM in the system as well as the free RAM. Now earlier I had a major calculation error for calculating the ram usage percentage, but unfortunately, no one reported it except @pross. After he reported it I looked into the math and it seems the way it was calculating the percentage was: (free ram/total ram)*100, which is completely wrong.
So, now what the plugin does is, it subtracts the free ram from the total ram value to get the used ram value data. Then it uses (used ram/total ram)*100 to calculate the actual ram usage. It also now shows the actual free ram in your system, just to give you a better perspective.
I hope this clarifies all your queries, let me know if you have any other questions and thanks again to pross from reporting the issue, without his report, this would have gone completely unnoticed.
I found this thread, after posting an Issue report on Github.
What you’ve written here seems to address the issue I have reported. However, I am wondering about which data from /proc/meminfo is most relevant. I see it reporting:
`
MemTotal: 2048112 kB
MemFree: 325808 kB
MemAvailable: 1363144 kB
`
Based on the memory usage reported by top/htop, and also by the monitor on my server, the MemAvailable appears to be the more accurate indication of RAM available. It’s the one that matches top/htop and the server RAM monitor. It shows that 684968 is in use, which is about 33%.
This matches what TOP shows:
`
KiB Mem : 2048112 total, 310804 free, 385364 used, 1351944 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 1349148 avail Mem
`
and HTOP, and the RAM monitor (on Digital Ocean dashboard).
Perhaps your plug-in needs to use the MemAvailable number for its calculation?
[PS. I’ll post a copy of this to the Git issue]
@inspired888 I have replied you on github.
Hi Saumya. Thanks for letting me know. The reply is not showing on Github. Have you submitted it yet?
@inspired888 Yes I have and I’ve also pushed a fix in the GitHub, please try it out and let me know if it fixes the issue and makes the data accurate.
Thanks, @inspired888 for reporting the problem and doing the research, the fix has been pushed publicly in v1.6.1