As I mentioned the other day, my VM was slow, so I needed a way to figure out which VM guests were causing the heavy load on our Proxmox platform.

I hacked up proxtop to enumerate the top resource users:

$ ./proxtop -t day proxmox.example.com monitor@pve
Password:<enter password>
SORTED BY: cpu, avg
...

SORTED BY: diskread, avg
------------------
#0:    3.1 MiB/s  pve10 (acme-bugs-bunny)
#1:    1.3 MiB/s  pve07 (customerX-private)
#2:  992.3 KiB/s  pve10 (acme-road-runner)
...

SORTED BY: diskwrite, avg
...
SORTED BY: netin, avg
...
SORTED BY: netout, avg
...

Like the example above shows, you get the top heaviest users for each of these resources: cpu, diskread, diskwrite, netin, netout.

Using the proxmoxer Python API worked intuitively; but see this:

  • The proxmoxer README shows this example to list all VMs.

    for node in proxmox.nodes.get():
        for vm in proxmox.nodes(node['node']).openvz.get():
            print "{0}. {1} => {2}" .format(vm['vmid'], vm['name'], vm['status'])
    

    That second get() got me 0 VMs. I went with this:

    for vm in proxmox.cluster.resources.get(type='vm'):
        print "{0}. {1} => {2}" .format(vm['vmid'], vm['name'], vm['status'])
    
  • I had to filter out some records that were obviously invalid — large net reads/writes or large disk reads/writes — using a custom foreach that ignores insanely high values.

  • VMs with only a single RRD data row tended to contain invalid values as well.

I hope it is useful to you too.

python resources proxmox