get performance metrics from vm

RolandK

Renowned Member
Mar 5, 2019
971
198
88
51
i'm somehow lost, i think i did this in the past and found some info for that, but it's sometimes hard to find the right information again if you don't remeber the details...

how can i easily query a virtual machines performance data at detail level via browser or cli , for example r/w bandwidth, iops or bytes read/written since start ?

i'm sure i have seen an example in the past but i don't remember.
some command like this only seems to provide the data which is already provided via gui, i'm searching for a more in depth view / access to the raw metrics on a per virtual
disk level, whereas "pvesh get ..." only seems to provide a consoldated view, as the gui does

pvesh get /nodes/pve-bigiron/qemu/101/rrddata --timeframe day --output-format json |jq

thank you
 
Not sure if PVE actually monitors IOPS and so on. I don't think so. iostat of the sysstat package could monitor iops, bytes read/written since start, r/w bandwidth and so on. But you would either need to run it inside the VM (so SSH into the VM from the host) or in case of ZFS run iostat on the PVE host and then somehow map the "zdX" to the virtual disks of that VM.

Code:
root@j3710:~# iostat -h
Linux 5.15.74-1-pve (j3710)     12/16/2022      _x86_64_        (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
          23.4%    0.0%   18.9%    0.2%    0.0%   57.5%

      tps    kB_read/s    kB_wrtn/s    kB_dscd/s    kB_read    kB_wrtn    kB_dscd Device
     1.20       153.3k         0.0k         0.0k      13.8G       0.0k       0.0k dm-0
     0.00         0.0k         0.0k         0.0k     229.5k       0.0k       0.0k dm-1
     0.00         0.0k         0.0k         0.0k      54.0k       0.0k       0.0k dm-2
     0.00         0.0k         0.0k         0.0k      36.0k       0.0k       0.0k dm-3
     0.00         0.0k         0.0k         0.0k      18.0k       0.0k       0.0k dm-4
     1.20       153.4k         0.0k         0.0k      13.8G       0.0k       0.0k md127
   117.79       397.1k         1.5M         0.0k      35.8G     135.0G       0.0k sda
   117.17       243.9k         1.5M         0.0k      22.0G     135.0G       0.0k sdb
     1.38       187.5k        15.6k         0.0k      16.9G       1.4G       0.0k zd0
     1.49         1.4M         1.1k         1.3M     128.0G      97.9M     123.3G zd112
     0.00         0.0k         0.0k         0.0k    1001.5k      20.0k       0.0k zd128
     0.62        31.1k        11.1k         0.0k       2.8G       1.0G       0.0k zd144
     7.90       371.7k       135.1k         0.0k      33.5G      12.2G       0.0k zd16
     3.06       363.6k        69.7k         0.0k      32.8G       6.3G       0.0k zd160
     0.03        22.3k         0.0k         0.0k       2.0G       0.0k       0.0k zd176
     0.93       184.1k         5.7k       142.0k      16.6G     528.6M      12.8G zd192
     1.26        93.1k         5.7k        59.0k       8.4G     529.9M       5.3G zd32
     0.01        11.2k         0.0k         0.0k       1.0G       0.0k       0.0k zd48
     3.93       396.6k        25.5k       289.4k      35.7G       2.3G      26.1G zd64
     0.05        44.4k         0.0k         0.0k       4.0G       0.0k       0.0k zd80
     0.04        44.4k         0.0k         0.0k       4.0G       0.0k       0.0k zd96
zd144, zd112 and zd64 are for example the 3 disks of my VM 110.

You can find out what zdX belongs to which VM by running this: find /dev/zvol -type l -print -exec readlink {} \;
 
good to know that you can monitor zvols individually, but i don't use those and you need to map zvol names to vm names on your own.

i'd like to get the metrics from hypervisor level/engine