Proxmox VE API via Proxmoxer

riaanp

New Member
Jun 15, 2022
23
1
1
I found a interesting problem. Not sure if it is a bug or if this is even the right place to ask. Using the proxmoxer python library, I am able to extract a list of running VMs and their IPs. But if the OS is RHEL9/OEL9/Rocky Linux 9 etc. I am unable to extract running IP from those hosts. The QEMU agent is running and installed (latest version).

This is all I can get:

JSON:
{'balloon': 0, 'ide0': 'datastore: 159/vm-159-cloudinit.qcow2,media=cdrom', 'agent': '1', 'efidisk0': 'datastore: 159/vm-159-disk-0.qcow2,efitype=4m,pre-enrolled-keys=1,size=528K', 'memory': 16384, 'vmgenid': 'c156a1ad-d654-4c82-bf38-941a06541947', 'meta': 'creation-qemu=6.2.0,ctime=1663587543', 'description': 'none', 'ostype': 'l26', 'net0': 'virtio=C2: 84:1E: 04: 30: 55,bridge=vmbr1,firewall=1,tag=39', 'bios': 'ovmf', 'smbios1': 'uuid=019b3bcb-b730-4288-96d7-acbab7f2cb70', 'cpu': 'host', 'scsi0': 'datastore: 159/vm-159-disk-1.qcow2,size=71G', 'name': 'tmpl-linux-RL9x', 'boot': 'order=scsi0;ide2;net0', 'ide2': 'none,media=cdrom', 'parent': 'afterupdate', 'numa': 0, 'cores': 2, 'sockets': 1, 'scsihw': 'virtio-scsi-pci', 'digest': 'f57fb5ab2fe6d924830947eb2762eb1f603a20d0'
}

Anyone any idea why?
 
no, I have not yet. Good suggestion. Will create something in bash and let you know.

But just out of interest. The WEB UI shows the IP. And my assumption is it is getting it from the qemu agent.

1674570488724.png
 
The CURL API request shows me the exact same information:

1674572192481.png

Now this is just weird. Why would the UI show it, but not the API?
 
Hello,


May you tell us which API endpoint you are using? I installed Rocky 9 on my lab and the below command or the API shows me the IP Address.

CLI:
Bash:
pvesh get /nodes/<NodeName>/qemu/<VMID>/agent/network-get-interfaces --output-format json | jq
HTTP:
Code:
GET /api2/json/nodes/{node}/qemu/{vmid}/agent/network-get-interfaces
 
ahh that works! I tried you API endpoint and it returned a IP. This is most definitely me doing something wrong then

I was using this to get the VM config via proxmoxer
Python:
    for vm in proxmox.nodes(node["node"]).qemu.get():
        if vm["status"] == 'running':

            conf = proxmox.nodes(node['node']).qemu(vm['vmid']).config.get()

Thank you for the assistance.