how long VMs are running

tincboy

Renowned Member
Apr 13, 2010
466
6
83
I need a command like `qm list` which shows how long each VM is running,
Any suggestion on finding VMs running time in shell?
 
Thanks Erk, this one works.
But this command only works on Proxmox 2, any suggestion for Proxmox 1.9? I've still many servers with Proxmox 1.9
 
Thanks Erk, this one works.
But this command only works on Proxmox 2, any suggestion for Proxmox 1.9? I've still many servers with Proxmox 1.9

Sorry, I can't help you there, I recently updated all my Proxmox servers to 2.1 don't have any 1.9 to test it on.
 
this one works on both 1.9 and 2.1
Code:
ps -o etime `cat /var/run/qemu-server/$vmid.pid`
 
Another command which will give you all the kvm VM at once is

Code:
/bin/ps axo pid,cmd,etime | grep chard

   1941 /usr/bin/kvm -id 301 -chard 20-00:01:30
   1960 /usr/bin/kvm -id 302 -chard 20-00:01:26
   1990 /usr/bin/kvm -id 303 -chard 20-00:01:22
   2040 /usr/bin/kvm -id 305 -chard 20-00:01:14
   2071 /usr/bin/kvm -id 306 -chard 20-00:01:10
   5574 /usr/bin/kvm -id 304 -chard 19-23:19:46
 
Last edited: