vzfree utility to check memory usage in OpenVZ VPS

From the official blog post

Gee. It has been a while since I’ve last written here, and it will be a while again for my next post as I will be on holidays from next Monday (visiting families in Hong Kong and Taiwan). Let me share one small utility program that I wrote quite a while ago.

We all know that the Linux command free(1) is pretty useless inside an OpenVZ VE, even those with meminfo virtualised. So I basically wrote this little util to grab the data from the dreadful user_beancounters and format them into something useful. It’s written in C and only depends on libc so it’s pretty light weight. It also does a little bit of analysis instead of just dumping the data, which I will explain later on.

To install vzfree, do this

apt-get install build-essential

then download the vzfree compressed file from the official website using wget (check the official blog post for updated version if the following one is not working)

wget http://hostingfu.com/files/vzfree/vzfree-0.1.tgz

Extract the file

tar -vxf vzfree-0.1.tgz

then do

cd vzfree-0.1

Now the final step

make && sudo make install

Now try running the utility from shell

root@ed3:~# vzfree
             Total     Used     Free
Kernel:   2048.00M    1.83M 2046.17M
Allocate:  512.00M   60.36M  451.64M (256M Guaranteed)
Commit:    256.00M   23.32M  232.68M (35.6% of Allocated)
Swap:                 0.00M          (0.0% of Committed)

One thought on “vzfree utility to check memory usage in OpenVZ VPS

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.