Node.js get actual memory usage as a percent

Viewed 7281

I have used "os" http://nodejs.org/api/os.html#os_os To attempt to calculate some system stats for use in an app.

However I notice that it cannot actually calculate the memory properly, because it leaves out the cache and buffers witch is needed to properly calculate a single readable percentage. Without it the memory will almost always be 90%+ with most high performance servers (based on my testing).

I would need to calculate it like so:

(CURRENT_MEMORY-CACHED_MEMORY-BUFFER_MEMORY)*100/TOTAL_MEMORY

This should get me a more accurate % of memory being used by the system. But the os module and most other node.js modules I have seen only get me total and current memory.

Is there any way to do this in node.js? I can use Linux but I do not know the ins and outs of the system to know where to look to figure this out on my own (file to read to get this information, like top/htop).

2 Answers
Related