[REST API] Most optimal way to obtain a list of all VMs and their configs?

PhantexTech

Member
Jun 7, 2020
15
3
23
34
Currently, there doesn't appear to be a single http get to obtain all VMs in the cluster. Right now, I have to query the cluster to obtain the nodes, then query each node for what VMs they have, then on top of that, query each node again for each individual VM config. As you can imagine, when the cluster is remote at a datacenter and there are 30-50 hosts with a bunch of VMs/CTs, it can take a while. What is the most optimal way where I can in one swoop get all the information instead of synchronously querying things remotely (the number of network connects can be hundreds). It would be nice if I can just query the cluster with the requested parameters and receive everything in one response or in the least number of requests.
 
urrently, there doesn't appear to be a single http get to obtain all VMs in the cluster. Right now, I have to query the cluster to obtain the nodes, then query each node for what VMs they have, then on top of that, query each node again for each individual VM config.
You can cut the 3 steps down to 2 by sending a query to cluster/resources. That will give you nodes and VMs in the cluster.

For individual VM config you need to iterate over them.
It would be nice if I can just query the cluster with the requested parameters and receive everything in one response or in the least number of requests.
For this, you will probably have to build your own front-end that runs locally to the cluster and regularly collects data from the cluster. You would then customize the type of query it will accept and what data it will spit out.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
You can cut the 3 steps down to 2 by sending a query to cluster/resources. That will give you nodes and VMs in the cluster.

For individual VM config you need to iterate over them.

For this, you will probably have to build your own front-end that runs locally to the cluster and regularly collects data from the cluster. You would then customize the type of query it will accept and what data it will spit out.


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
Thanks! You are right. I should be querying for the resources. That will help big time. Not sure how I overlooked that.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!