how long VMs are running

tincboy

Renowned Member
Apr 13, 2010
466
4
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:

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!