I am using qemu-kvm (libvirt) on Ubuntu 20.04. I’ve created virtual machine with 8 CPU and installed node-exporter on vm and libvirt-exporter on hv.
Node exporter on virtual machine says that CPU usage is something about 50% (4 out of 8 CPU are used):
Metric:
(((count(count(node_cpu_seconds_total{node=~"iothub-1",job="node-exporter"}) by (cpu))) - avg(sum by (mode)(rate(node_cpu_seconds_total{mode='idle',node=~"iothub-1",job="node-exporter"}[$__rate_interval])))) * 100) / count(count(node_cpu_seconds_total{node=~"iothub-1",job="node-exporter"}) by (cpu))
But libvirt exporter on hypervisor shows a different picture:
Metric: rate(libvirt_domain_info_cpu_time_seconds_total{namespace="$namespace",host=~"$instance_name"}[1m])
The usage of VM is more than 500% – 5 cores. I have 16 cores on hypervisor.
virsh cpu-stats:
user@iot:~$ sudo virsh cpu-stats iothub-1 --total
Total:
cpu_time 1801252.025306000 seconds
user_time 1278780.403019000 seconds
system_time 522471.622286000 seconds
Where am i mistaking? Which metric of CPU usage should i rely on?