An "API" for container stats?

Recently I was working on an image hosting project. Images are stored in the project and those take up space. I would like to somehow get how much storage I have left in the project so I can make sure not to accidentally suspend the project. I could only find a way to do this in C#, and I am not using that. Is there a way to do this in Express/Node?

I have an idea, hang on…

1 Like

Okay, I need to know which of the following values is the amount of memory used:

cache 90288128
rss 159412224
rss_huge 0
mapped_file 3436544
dirty 0
writeback 0
pgpgin 4849689
pgpgout 4788727
pgfault 6963737
pgmajfault 1021
inactive_anon 79060992
active_anon 80306176
inactive_file 44552192
active_file 45735936
unevictable 0
hierarchical_memory_limit 6442450944
total_cache 90288128
total_rss 159412224
total_rss_huge 0
total_mapped_file 3436544
total_dirty 0
total_writeback 0
total_pgpgin 4849689
total_pgpgout 4788727
total_pgfault 6963737
total_pgmajfault 1021
total_inactive_anon 79060992
total_active_anon 80306176
total_inactive_file 44552192
total_active_file 45735936
total_unevictable 0


  1. To get info on memory usage, try cat /sys/fs/cgroup/memory/memory.stat. That will display the contents of the memory.stat file in the terminal.

  2. For CPU usage, try grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}' (Discord Bot High CPU usage, visual error?)

  3. Additionaly, you can use an npm package like express-status-monitor to show stats. Demo:

And a #feature-ideas for a container stats API would be awesome!