List proxmox VM/CTs for cluster with IP addresses

TwiX

Renowned Member
Feb 3, 2015
320
23
83
Hi,

Is there a way to get a list of all VM/CTs for a cluster including IP addresses ?

qm list / pct list do not provide IPs I guess.

Thanks !
 
for VMs you need to list all for all running VMs
Bash:
qm list | grep running | awk {'print $1'}
then execute command like:

Bash:
qm guest exec <VMID> -- ip a | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -n 2 | tail -1

and for the CT's same thing
Bash:
pct list | grep running | awk {'print $1'}
for list all running containers then exec and grep the IP

Bash:
pct exec <VMID> -- ip a | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" | head -n 2 | tail -1