I'm trying to create a realtime dashboard of the number of running/stopped VMs on a Proxmox cluster.
What is the easiest way of doing this?
qm list seems to be one option:
Or I can use the REST api:
Firstly - is there an alternative way to get this data? (Just wondering if easier way - or if the above approaches I found are the best).
Second, is there a way, using the API, to target *all* nodes in the cluster, or do you have to specify them all, individually?
Thirdly, And is there any way to get the username who started the VM as well, somehow?
Thanks,
Victor
What is the easiest way of doing this?
qm list seems to be one option:
Code:
root@foo-vm01:~# qm list --full true
VMID NAME STATUS MEM(MB) BOOTDISK(GB) PID
100 aruba-mobility-master-8.5-september-2019 stopped 8192 4.00 0
101 accessing-aruba stopped 4000 30.00 0
102 aruba-mobility-master-8.6-january-2020 stopped 12000 6.00 0
500 win7-base running 4000 30.00 237352
502 win8.1-base running 4000 0.00 237418
503 win10-base running 4000 0.00 242001
504 win10-fasttrack-base running 4000 0.00 237194
700 win7-with-software stopped 4000 30.00 0
701 win8.1-with-software stopped 4000 0.00 0
Or I can use the REST api:
Code:
root@foo-vm01:~# pvesh get /nodes/angussyd-vm01/qemu
┌─────────┬──────┬──────┬──────┬───────────┬───────────┬──────────────────────────────────────────┬────────┬───────────┬──────┬────────────┐
│ status │ vmid │ cpus │ lock │ maxdisk │ maxmem │ name │ pid │ qmpstatus │ tags │ uptime │
╞═════════╪══════╪══════╪══════╪═══════════╪═══════════╪══════════════════════════════════════════╪════════╪═══════════╪══════╪════════════╡
│ running │ 503 │ 2 │ │ 0.00 B │ 3.91 GiB │ win10-base │ 242001 │ │ │ 6h 23m 7s │
├─────────┼──────┼──────┼──────┼───────────┼───────────┼──────────────────────────────────────────┼────────┼───────────┼──────┼────────────┤
│ running │ 502 │ 2 │ │ 0.00 B │ 3.91 GiB │ win8.1-base │ 237418 │ │ │ 6h 23m 11s │
├─────────┼──────┼──────┼──────┼───────────┼───────────┼──────────────────────────────────────────┼────────┼───────────┼──────┼────────────┤
│ running │ 500 │ 2 │ │ 30.00 GiB │ 3.91 GiB │ win7-base │ 237352 │ │ │ 6h 23m 13s │
├─────────┼──────┼──────┼──────┼───────────┼───────────┼──────────────────────────────────────────┼────────┼───────────┼──────┼────────────┤
│ running │ 504 │ 2 │ │ 0.00 B │ 3.91 GiB │ win10-fasttrack-base │ 237194 │ │ │ 6h 23m 18s │
├─────────┼──────┼──────┼──────┼───────────┼───────────┼──────────────────────────────────────────┼────────┼───────────┼──────┼────────────┤
│ stopped │ 101 │ 2 │ │ 30.00 GiB │ 3.91 GiB │ accessing-aruba │ │ │ │ │
├─────────┼──────┼──────┼──────┼───────────┼───────────┼──────────────────────────────────────────┼────────┼───────────┼──────┼────────────┤
│ stopped │ 700 │ 2 │ │ 30.00 GiB │ 3.91 GiB │ win7-with-software │ │ │ │ │
├─────────┼──────┼──────┼──────┼───────────┼───────────┼──────────────────────────────────────────┼────────┼───────────┼──────┼────────────┤
│ stopped │ 102 │ 3 │ │ 6.00 GiB │ 11.72 GiB │ aruba-mobility-master-8.6-january-2020 │ │ │ │ │
├─────────┼──────┼──────┼──────┼───────────┼───────────┼──────────────────────────────────────────┼────────┼───────────┼──────┼────────────┤
│ stopped │ 701 │ 2 │ │ 0.00 B │ 3.91 GiB │ win8.1-with-software │ │ │ │ │
├─────────┼──────┼──────┼──────┼───────────┼───────────┼──────────────────────────────────────────┼────────┼───────────┼──────┼────────────┤
│ stopped │ 100 │ 6 │ │ 4.00 GiB │ 8.00 GiB │ aruba-mobility-master-8.5-september-2019 │ │ │ │ │
└─────────┴──────┴──────┴──────┴───────────┴───────────┴──────────────────────────────────────────┴────────┴───────────┴──────┴────────────┘
Firstly - is there an alternative way to get this data? (Just wondering if easier way - or if the above approaches I found are the best).
Second, is there a way, using the API, to target *all* nodes in the cluster, or do you have to specify them all, individually?
Thirdly, And is there any way to get the username who started the VM as well, somehow?
Thanks,
Victor