Feature-Request: Search for IP-addresses

#!/bin/bash
time qm list |column -t

for vmid in $(qm list |grep running |awk '{print $1}'); do
echo "$(date) - Checking $vmid"
qm agent $vmid ping; rc=$?
if [ $rc -gt 0 ]; then
echo "$vmid guest agent not responding!"
continue;
fi

qm guest cmd $vmid get-host-name |tr -d '{}' |awk 'NF>0'

qm guest cmd $vmid network-get-interfaces |grep ip-address

done >/tmp/vm-ips.txt

# grep / less /tmp/vm-ips.txt and find IP , surrounding text will give you hostname
# parsing complete JSON output is up to you
# Be aware that querying the guest agent is sometimes not reliable, if you limit the VM's cpu resources it can time out even if the agent is running

# Feel free to request this as a feature in the proxmox bug tracker, would come in handy in the GUI
 
Last edited:
100% love the cli script thank you.
I would think it would be geat if IP and MAC on the Data Center search or at min have the columns show this data.
 
  • Like
Reactions: Kingneutron

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!