TwiX Renowned Member Feb 3, 2015 311 23 83 Apr 26, 2021 #1 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 !
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 !
Moayad Proxmox Staff Member Staff member Jan 2, 2020 3,342 324 108 31 Vienna shop.proxmox.com Apr 26, 2021 #2 You can do a bash script but make sure that your VMs has a Qemu-Guest-Agent
TwiX Renowned Member Feb 3, 2015 311 23 83 Apr 26, 2021 #3 Indeed What kind of command do I need ? (For VM/CTs)
Moayad Proxmox Staff Member Staff member Jan 2, 2020 3,342 324 108 31 Vienna shop.proxmox.com Apr 26, 2021 #4 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
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