Proxmox API, check qemu installed and extract tags

eviatars-chkp

New Member
Nov 18, 2024
17
0
1
Hey, I have 2 questions about using Proxmox API:
1. Running nodes/{pve}/qemu/ return list of all my vms, but running {node}/qemu/{vmid}/agent is limited to machine with qemu-guest-agent installed.
Is there a way to check (with API commands) which machine has qemu-guest-agent installed?
2. I know it possible to get all VMs and extract the tags from them, but is there a way to opposite ("reverse mapping": with given tags I get all VMs that shared it?)

Thanks
 
Hi,
Hey, I have 2 questions about using Proxmox API:
1. Running nodes/{pve}/qemu/ return list of all my vms, but running {node}/qemu/{vmid}/agent is limited to machine with qemu-guest-agent installed.
Is there a way to check (with API commands) which machine has qemu-guest-agent installed?
The /nodes/{node}/qemu/{vmid}/agent endpoint will always return the list of sub-commands for the guest agent regardless of whether the agent is installed/configured or not. You can check if it is configured by looking at the VM configuration, but you can only know whether it is actually installed/running by talking to the guest itself. Use the guest-agent ping command for that.
2. I know it possible to get all VMs and extract the tags from them, but is there a way to opposite ("reverse mapping": with given tags I get all VMs that shared it?)
You can use the /cluster/resources endpoint and then filter by type=vm and/or type=lxc and then filter the ones containing the correct tag(s).
 
  • Like
Reactions: eviatars-chkp