CPU & Memory usage via shell

tincboy

Renowned Member
Apr 13, 2010
466
6
83
Hello,
Is it possible to get CPU & Memory usage of VMs via shell not web interface of Proxmox?
 
Hi,
for kvm yes - you have one kvm-process for each vm.
look with "ps -aux | grep VMID" and "top".

Udo
ps aux | grep 111
root 20725 51.7 2.2 366492 272268 ? Sl 03:11 17:03 /usr/bin/kvm -monitor unix:/var/run/qemu-server/111.mon,server,nowait -vnc unix:/var/run/qemu-server/111.vnc,password -pidfile /var/run/qemu-server/111.pid -daemonize -usbdevice tablet -name srv263 -smp sockets=1,cores=1 -id 111 -boot cad -vga cirrus -tdf -localtime -rtc-td-hack -k en-us -drive file=/var/lib/vz/images/111/vm-111-disk-1.raw,if=ide,index=0,boot=on -drive file=/var/lib/vz/template/iso/2003-cd1.iso,if=ide,index=2,media=cdrom -m 256 -net tap,vlan=0,ifname=vmtab111i0,script=/var/lib/qemu-server/bridge-vlan -net nic,vlan=0,model=rtl8139,macaddr=B6:6D:BB:70:FF:55 -cpuunits 400
root 22047 0.0 0.0 3880 612 pts/0 S+ 03:44 0:00 grep 111

so How can I know the CPU and Mem usage now?
 
You can also do something like this:
Code:
top -b -n1 -p `cat /var/run/qemu-server/111.pid`
Udo
Thanks,
But these numbers are in difference with what Proxmox shows in the web interface, and the memory is in percentage of whole server's memory,
Can't we get more accurate numbers?

Regards
 
Thanks,
But these numbers are in difference with what Proxmox shows in the web interface, and the memory is in percentage of whole server's memory,
Can't we get more accurate numbers?

There will be an API in V2.0, where you can get all those values - for now, you need use values form ps/top.