List VM's with qemu-agent installed or not installed

michaljot

New Member
Jan 23, 2023
2
0
1
Hi guys, i have a cluster with 200+vm's i want to list all vm's that have'nt installed (or have installed) qemu agent, how can i do this? What a command i can use to do it? Is it possible?
 
qm guest cmd ${VMID} ping will tell you if the Guest Agent is responding inside VM ${VMID}. Now you just have to run this command with the VMID for each of your VM's. You can get the VMID's using qm list and loop over it using some bash shell scripting. Maybe there is an easier way using pvesh?
 
  • Like
Reactions: michaljot
qm guest cmd ${VMID} ping will tell you if the Guest Agent is responding inside VM ${VMID}. Now you just have to run this command with the VMID for each of your VM's. You can get the VMID's using qm list and loop over it using some bash shell scripting. Maybe there is an easier way using pvesh?
Thank's, i created script with your recommendations and it works!
 
Thank's, i created script with your recommendations and it works!
I am not good at Linux scripting and would appreciate your sharing your script.

EDIT:
Nevermind, I think I managed to get one to work. For those who are interested, here is mine and if you can improve it, please share.

#!/bin/bash
for vmid in $(qm list | awk '{print $1}' | grep -v VMID); do
echo "qm agent ping vmid: $vmid"
qm agent $vmid ping
echo ""
done
 
Last edited: