How to get config of each VM, including disks and location through API

SomeGuy42

New Member
Aug 22, 2025
13
0
1
How to get config of each VM, including disks and location through API?

I am able to get the VM information from the api or pvesh, but neither shows the disk config or where the virtual disks reside. I have gone through the API browser and don't see this information there.

Is there a feature request for this sort of info? We would want to be able to export all the virtual hardware information out of proxmox and in to our inventory system every day.
 
I can get the info from from one call to config:

Code:
root@proxmox6 ~ > pvesh get /nodes/proxmox6/qemu/30000/config
┌─────────────┬────────────────────────────────────────────────────────────────────────────────────────────┐
│ key         │ value                                                                                      │
╞═════════════╪════════════════════════════════════════════════════════════════════════════════════════════╡
│ agent       │ 1                                                                                          │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ balloon     │ 0                                                                                          │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ boot        │ order=scsi0;ide2;net0                                                                      │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ cores       │ 2                                                                                          │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ cpu         │ host                                                                                       │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ description │ # Proxmox 8 Test mit ext4                                                                  │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ digest      │ a7838046052c711d81c6eb78af5347ae87a460ae                                                   │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ ide2        │ none,media=cdrom                                                                           │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ memory      │ 8192                                                                                       │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ name        │ proxmox8-ext4                                                                              │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ net0        │ virtio=6A:EC:AA:BD:96:21,bridge=vmbr0,firewall=1                                           │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ numa        │ 1                                                                                          │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ ostype      │ l26                                                                                        │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ scsi0       │ ceph:vm-30000-disk-0,discard=on,iothread=1,size=16G,ssd=1                                  │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ scsihw      │ virtio-scsi-single                                                                         │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ smbios1     │ uuid=b95ed470-4ea0-48f2-92ef-df111af67534,serial=MzAwMDA=,base64=1                         │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ sockets     │ 2                                                                                          │
├─────────────┼────────────────────────────────────────────────────────────────────────────────────────────┤
│ vmgenid     │ 970297f6-122d-4f31-b34d-476d7d827f4c                                                       │
└─────────────┴────────────────────────────────────────────────────────────────────────────────────────────┘

I can see where the disk is stored (ceph) and how big it is.
 
Thanks, i can put that in the api and get the info, so that is a help, but I want to get this for every VM in the cluster without having to know the node it lives on or it's VMID. We will have clusters that range from 200 to 1000 vms in them, and it's a very dynamic environment.

I can do it for the VMs, but it only shows real time data, not config info.
 
Thanks, i can put that in the api and get the info, so that is a help, but I want to get this for every VM in the cluster without having to know the node it lives on or it's VMID.
There is no one api call do to it all, we are not in Mordor ;). You need to loop over all nodes and then over all VMs for each node and then get the config. Can be simply done in any programming language with an API to proxmox ve. A similar approach is shown for PBS in this thread.

I can do it for the VMs, but it only shows real time data, not config info.
What do you mean by real time data? The example I gave you is the config. How often do you change stuff for VMs so that you will not have real data = config data?
 
  • Like
Reactions: UdoB
When operating at a scale of 1,000 VMs, it may make sense to maintain your own inventory database. You could, for example, integrate ctime or another tag to track changes.


As others have pointed out, you’ll likely need some custom work to get the exact view you want. That said, there are plenty of community scripts out there that can provide partial solutions to build on. There are also commercial tools and services that may be able to help, or even develop a custom view tailored to your needs.


Good luck!


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
There is no one api call do to it all, we are not in Mordor ;). You need to loop over all nodes and then over all VMs for each node and then get the config. Can be simply done in any programming language with an API to proxmox ve. A similar approach is shown for PBS in this thread.


What do you mean by real time data? The example I gave you is the config. How often do you change stuff for VMs so that you will not have real data = config data?
I mean that it shows CPU, memory, network in/out, etc. we just want the config data. Outcome of the one liner:

"name": "REDACTED",
"mem": 3354959872,
"tags": "REDACTED",
"status": "running",
"pool": "INF",
"maxdisk": 128849018880,
"diskwrite": 340733473792,
"uptime": 286851,
"diskread": 1161183744,
"netin": 675412199,
"hastate": "started",
"cpu": 0.020440446538266,
"maxmem": 8589934592,
"memhost": 8619719680,
"netout": 103140137,
"id": "qemu/922",
"disk": 0,
"vmid": 922,
"node": "REDACTED",
"type": "qemu",
"template": 0,
"maxcpu": 2


If its possible to pull this data with one liner from curl, I guess I don't see why it seems unreasonable to ask for the same for static inventory data.

We have some pretty good scripting people that can make it work the way it is, and I appreciate your insights.
 
Last edited:
What did you query / what was the actual api call? My call from comment 2 just gets the config
Yes, but I need to know all of the VMIDs and nodes to run that command for everything on the cluster.

I'd like a one liner that just dumps all the VMs and their configs.

This gets all the current data (like I show above) of all VMs - but not all the config data:

curl -k -s -X GET "https://hostname:8006/api2/json/cluster/resources?type=vm"
-H 'Authorization: PVEAPIToken=user@realm!ro=secret'
 
I'd like a one liner that just dumps all the VMs and their configs.
Technically this is a one-liner:
for node in $(pvesh get /nodes --output-format=json | jq -r '.[].node'); do for vmid in $(pvesh get /nodes/$node/qemu --output-format=json | jq -r '.[].vmid'); do pvesh get /nodes/$node/qemu/$vmid/config --output-format=json | jq --arg node "$node" --arg vmid "$vmid" '. + {node:$node, vmid:$vmid}'; done; done

Beyond this, the alternatives are described here: https://www.proxmox.com/en/about/open-source/developers
They boil down to two : file a bugzila report or send code patch that you have written.

Cheers


Blockbridge : Ultra low latency all-NVME shared storage for Proxmox - https://www.blockbridge.com/proxmox
 
  • Like
Reactions: UdoB and LnxBil