Obtaining balloon memory statistics within a Linux vm (kvm)?

Does anyone know how to obtain balloon memory statistics within a vm? I’ve scoured google, stack overflow, twitter, and the like.

I’m attempting to set up a monitor to pull the metric but I’m at a loss where the metric is located. I would assume there is a metric somewhere…

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

MolbOrg directed me in the right direction. Currently there is no simple method of pulling the metrics from within the VM without writing a program to extract the metrics from the QEMU Object Model.

Both libvirt and proxmox are able to obtain the metrics at the hypervisor level without too much trouble, see here.

FYI: to force the balloon to action, set change the memory shares to say 0 or some other low value (default=1000). Be aware setting it to 0 will force the VM to decrease available memory to the minimum memory setting and may cause the kernel to panic if it is set too low.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply