Skip to content

libvirtd

Auto-Detection
Exporter Metrics

Bleemeo monitors the libvirtd virtualization daemon through automatic service detection and optional detailed metrics collection via a Prometheus exporter.

Glouton automatically detects libvirtd instances running on the host.

Detailed libvirt metrics are collected using the third-party prometheus-libvirt-exporter.

  • libvirt daemon installed and running
  • Glouton agent installed on the same host
  • The user running the exporter must have access to the libvirt socket

Download the latest release from the prometheus-libvirt-exporter releases page, or build from source:

Terminal window
git clone https://github.com/zhangjianweibj/prometheus-libvirt-exporter.git
cd prometheus-libvirt-exporter
go build -o prometheus-libvirt-exporter

Start the exporter:

Terminal window
./prometheus-libvirt-exporter

The exporter connects to the local libvirt daemon and listens on port 9000 by default. You can change the port with the --web.listen-address flag:

Terminal window
./prometheus-libvirt-exporter --web.listen-address=":9177"

Verify it is working:

Terminal window
curl http://localhost:9000/metrics

For production use, create a systemd service unit to manage the exporter process. Ensure the service runs as a user with access to the libvirt socket (typically the libvirt group).

Terminal window
sudo tee /etc/glouton/conf.d/99-libvirt.conf > /dev/null << 'EOF'
metric:
prometheus:
targets:
- url: "http://localhost:9000/metrics"
name: "libvirt"
allow_metrics:
- "libvirt_domain_info_state"
- "libvirt_domain_info_virtual_cpus"
- "libvirt_domain_info_cpu_time_seconds_total"
- "libvirt_domain_info_memory_usage_bytes"
- "libvirt_domain_info_maximum_memory_bytes"
- "libvirt_domain_block_stats_read_bytes_total"
- "libvirt_domain_block_stats_write_bytes_total"
- "libvirt_domain_interface_stats_receive_bytes_total"
- "libvirt_domain_interface_stats_transmit_bytes_total"
EOF

Glouton automatically detects configuration changes.

Metric Description
libvirt_domain_info_state State of the domain (1=running, 2=blocked, 3=paused, 5=shutoff)
libvirt_domain_info_virtual_cpus Number of virtual CPUs allocated to the domain
libvirt_domain_info_cpu_time_seconds_total Total CPU time consumed by the domain in seconds
libvirt_domain_info_memory_usage_bytes Current memory usage of the domain in bytes
libvirt_domain_info_maximum_memory_bytes Maximum memory available to the domain in bytes
libvirt_domain_block_stats_read_bytes_total Total bytes read from block devices by the domain
libvirt_domain_block_stats_write_bytes_total Total bytes written to block devices by the domain
libvirt_domain_interface_stats_receive_bytes_total Total bytes received on network interfaces by the domain
libvirt_domain_interface_stats_transmit_bytes_total Total bytes transmitted on network interfaces by the domain