libvirtd
Bleemeo monitors the libvirtd virtualization daemon through automatic service detection and optional detailed metrics collection via a Prometheus exporter.
Auto-Detection
Section titled “Auto-Detection”Glouton automatically detects libvirtd instances running on the host.
Exporter Metrics
Section titled “Exporter Metrics”Detailed libvirt metrics are collected using the third-party prometheus-libvirt-exporter.
Prerequisites
Section titled “Prerequisites”- libvirt daemon installed and running
- Glouton agent installed on the same host
- The user running the exporter must have access to the libvirt socket
Installing the Exporter
Section titled “Installing the Exporter”Download the latest release from the prometheus-libvirt-exporter releases page, or build from source:
git clone https://github.com/zhangjianweibj/prometheus-libvirt-exporter.gitcd prometheus-libvirt-exportergo build -o prometheus-libvirt-exporterStart the exporter:
./prometheus-libvirt-exporterThe 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:
./prometheus-libvirt-exporter --web.listen-address=":9177"Verify it is working:
curl http://localhost:9000/metricsFor 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).
Glouton Configuration
Section titled “Glouton Configuration”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"EOFCreate or edit C:\ProgramData\glouton\conf.d\99-libvirt.conf:
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"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 |