Skip to content
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus libvirt exporter

This wonderful software was originally authored by great engineers of Kumina(kudos!).

Since it was archived I've had troubles finding or building libvirt-exporter for Almalinux 10, and had struggles with other forks as well. Decided I might as well try to update it myself and share with others.

Just in case someone out there is as inept as I am 👋

This repository has been forked and slightly updated for ease of use:

  • Made use of DigitalOcean's go-libvirt instead of libvirt-go as I was slightly struggling with the latter one
  • Added error reporting all across exporter
  • Simplified Dockerfile as it was pulling unnecessary dependencies and seemed overcomplicated
  • Composed Makefile to provide simple shortcuts for docker
  • Vendored dependencies

HowTo

  • Want to know what commands implemented in make?
    make help
  • Want standalone binary?
    make binary
  • Want to run exporter in docker?
    make run
    Note: it will listen on 0.0.0.0:9177

Original README for Prometheus libvirt exporter

This repository provides code for a Prometheus metrics exporter for libvirt. This exporter connects to any libvirt daemon and exports per-domain metrics related to CPU, memory, disk and network usage. By default, this exporter listens on TCP port 9177.

This exporter makes use of libvirt-go, the official Go bindings for libvirt. Ideally, this exporter should make use of the GetAllDomainStats() API call to extract all relevant metrics. Unfortunately, we at Kumina still need this exporter to be compatible with older versions of libvirt that don't support this API call.

The following metrics/labels are being exported:

libvirt_domain_block_stats_read_bytes_total{domain="...",uuid="...",source_file="...",target_device="..."}
libvirt_domain_block_stats_read_requests_total{domain="...",uuid="...",source_file="...",target_device="..."}
libvirt_domain_block_stats_write_bytes_total{domain="...",uuid="...",source_file="...",target_device="..."}
libvirt_domain_block_stats_write_requests_total{domain="...",uuid="...",source_file="...",target_device="..."}
libvirt_domain_info_cpu_time_seconds_total{domain="...",uuid="..."}
libvirt_domain_info_maximum_memory_bytes{domain="...",uuid="..."}
libvirt_domain_info_memory_usage_bytes{domain="...",uuid="..."}
libvirt_domain_info_virtual_cpus{domain="...",uuid="..."}
libvirt_domain_interface_stats_receive_bytes_total{domain="...",uuid="...",source_bridge="...",target_device="..."}
libvirt_domain_interface_stats_receive_drops_total{domain="...",uuid="...",source_bridge="...",target_device="..."}
libvirt_domain_interface_stats_receive_errors_total{domain="...",uuid="...",source_bridge="...",target_device="..."}
libvirt_domain_interface_stats_receive_packets_total{domain="...",uuid="...",source_bridge="...",target_device="..."}
libvirt_domain_interface_stats_transmit_bytes_total{domain="...",uuid="...",source_bridge="...",target_device="..."}
libvirt_domain_interface_stats_transmit_drops_total{domain="...",uuid="...",source_bridge="...",target_device="..."}
libvirt_domain_interface_stats_transmit_errors_total{domain="...",uuid="...",source_bridge="...",target_device="..."}
libvirt_domain_interface_stats_transmit_packets_total{domain="...",uuid="...",source_bridge="...",target_device="..."}
libvirt_up

With the --libvirt.export-nova-metadata flag, it will export the following additional OpenStack-specific labels for every domain:

  • name
  • flavor
  • project_name

At Kumina we want to perform a single build of this exporter, deploying it to a variety of Linux distribution versions. This is why this repository contains a shell script, build_static.sh, that builds a statically linked copy of this exporter in an Alpine Linux based container.

About

Prometheus metrics exporter for libvirt.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages