libvirt-exporter icon indicating copy to clipboard operation
libvirt-exporter copied to clipboard

[BUG] Metrics for memory not working correctly

Open gorSign opened this issue 2 years ago • 3 comments

At least for: libvirt_domain_memory_stats_unused_bytes libvirt_domain_memory_stats_used_percent

I got wrong values. For 1st it is 3,66GB and 2nd is 7,29%, but should be total-used=1,6Gi and 2,2/3,8*100=58%.

System output:

free -h

          total        used        free      shared  buff/cache   available

Mem: 3.8Gi 2.2Gi 197Mi 3.0Mi 1.4Gi 1.3Gi Swap: 0B 0B 0B

cat /etc/lsb-release

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=20.04 DISTRIB_CODENAME=focal DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"

gorSign avatar Jul 01 '22 10:07 gorSign

Have you enabled memory statistics fetching for the balloon device? Not doing this may cause issues like that.

thannaske avatar Aug 06 '22 13:08 thannaske

Any hint how/where to do that please?

gorSign avatar Aug 22 '22 11:08 gorSign

Again...got a metrics: libvirt_domain_memory_stats_actual_balloon_bytes{domain="xx"} 4.294967296e+09 libvirt_domain_memory_stats_available_bytes{domain="xx"} 4.11518976e+09 libvirt_domain_memory_stats_disk_cache_bytes{domain="xx"} 1.62963456e+08 libvirt_domain_memory_stats_major_fault_total{domain="xx"} 0 libvirt_domain_memory_stats_minor_fault_total{domain="xx"} 0 libvirt_domain_memory_stats_rss_bytes{domain="xx"} 0 libvirt_domain_memory_stats_unused_bytes{domain="xx"} 3.930349568e+09 libvirt_domain_memory_stats_usable_bytes{domain="xx"} 3.812745216e+09 libvirt_domain_memory_stats_used_percent{domain="xx"} 7.349467743621135

and it is on the system:

free

          total        used        free      shared  buff/cache   available

Mem: 4026324 2221720 119064 2764 1685540 1535432 Swap: 0 0 0

Where to get used/free/available? Have no idea based on metrics that got from exporter. Also used/free=55,2% and not 7,35% as it is in libvirt_domain_memory_stats_used_percent. Any help?

Output from libvirt:

virsh dommemstat xx --current

actual 4194304 swap_in 0 swap_out 0 major_fault 0 minor_fault 0 unused 3838232 available 4018740 usable 3723384 last_update 1666251019 disk_caches 159144 hugetlb_pgalloc 0 hugetlb_pgfail 0 rss 4244716

gorSign avatar Oct 24 '22 14:10 gorSign