windows_exporter: Unable to get Hypervisor cpu load percentage
Hello,
I’m trying to monitor my hyper-V servers with WMI_Exporter but I can’t get the real cpu load, all I got are some random unitless numbers with wmi_hyperv_host_cpu_hypervisor_run_time
.
I also got the powershell command to get this numbers : Get-Counter -Counter “\Hyper-V Hypervisor Logical Processor(_Total)\% Total Run Time"
.
If anyone is interested in adding this in the exporter, it would be really great.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (8 by maintainers)
Those query look promising:
% consumption of the physical CPU ressources on Host
ServerName
by VMs (On a specific Host):(sum by (vm) (rate(windows_hyperv_vm_cpu_total_run_time{instance="ServerName"}[60s]))) / ignoring(vm) group_left sum (windows_cs_logical_processors{instance="ServerName"}) / 100000
% consumption of the physical CPU ressources by the VMs (On all Hosts):
(sum by (instance)(rate(windows_hyperv_vm_cpu_total_run_time{}[1m]))) / max by (instance)(windows_cs_logical_processors{}) / 100000
% consumption of the physical CPU ressources by the Hosts himself (On all Hosts):
(sum by (instance)(rate(windows_hyperv_host_cpu_total_run_time{}[1m]))) / sum by (instance)(windows_cs_logical_processors{}) / 100000
PS: The 100000 is a constant, don’t ask me why…
Hey, I just tried this one (after your query @JDA88):
sum(rate(windows_hyperv_vm_cpu_total_run_time{job="_windows_exporter_"}[2m])) by (instance) / sum(windows_cs_logical_processors{job="_windows_exporter_"}) by (instance) / 100000
It is is working okay.
The results are very different to:
sum(rate(windows_cpu_time_total{job="_windows_exporter_",mode!~"idle"}[2m])) by (instance)) * (100 / 7.5)
I can’t test which one is more correct right now. But you can see the difference here:
Good news, alter a lot of digging in the values I think I finally got the solution, I am able to compute those values:
Short answer: we just need a new counter value added to
hyperv.go
, or is it available already? could not find itUPDATE: Timestamp_PerfTime difference value is veri close to the number of second * 10000000. I’ll try to get it with the Uptime later today…
Long answer: You need all the following counters:
Once you have all those values, those are the calculation that give you the final values. The “_D” stand for the difference between two ticks
Here you quick PowerShell code that validate the calculation. It works on my Hyper-V
Hope this can help 😃