| 1 | # Prometheus libvirt exporter |
| 2 | |
| 3 | This repository provides code for a Prometheus metrics exporter |
| 4 | for [libvirt](https://libvirt.org/). This exporter connects to any |
| 5 | libvirt daemon and exports per-domain metrics related to CPU, memory, |
| 6 | disk and network usage. By default, this exporter listens on TCP port |
| 7 | 9177. |
| 8 | |
| 9 | This exporter makes use of |
| 10 | [libvirt-go](https://github.com/libvirt/libvirt-go), the official Go |
| 11 | bindings for libvirt. Ideally, this exporter should make use of the |
| 12 | `GetAllDomainStats()` API call to extract all relevant metrics. |
| 13 | Unfortunately, we at Kumina still need this exporter to be compatible |
| 14 | with older versions of libvirt that don't support this API call. |
| 15 | |
| 16 | The following metrics/labels are being exported: |
| 17 | |
| 18 | ``` |
| 19 | libvirt_domain_block_stats_read_bytes_total{domain="...",uuid="...",source_file="...",target_device="..."} |
| 20 | libvirt_domain_block_stats_read_requests_total{domain="...",uuid="...",source_file="...",target_device="..."} |
| 21 | libvirt_domain_block_stats_write_bytes_total{domain="...",uuid="...",source_file="...",target_device="..."} |
| 22 | libvirt_domain_block_stats_write_requests_total{domain="...",uuid="...",source_file="...",target_device="..."} |
| 23 | libvirt_domain_info_cpu_time_seconds_total{domain="...",uuid="..."} |
| 24 | libvirt_domain_info_maximum_memory_bytes{domain="...",uuid="..."} |
| 25 | libvirt_domain_info_memory_usage_bytes{domain="...",uuid="..."} |
| 26 | libvirt_domain_info_virtual_cpus{domain="...",uuid="..."} |
| 27 | libvirt_domain_interface_stats_receive_bytes_total{domain="...",uuid="...",source_bridge="...",target_device="..."} |
| 28 | libvirt_domain_interface_stats_receive_drops_total{domain="...",uuid="...",source_bridge="...",target_device="..."} |
| 29 | libvirt_domain_interface_stats_receive_errors_total{domain="...",uuid="...",source_bridge="...",target_device="..."} |
| 30 | libvirt_domain_interface_stats_receive_packets_total{domain="...",uuid="...",source_bridge="...",target_device="..."} |
| 31 | libvirt_domain_interface_stats_transmit_bytes_total{domain="...",uuid="...",source_bridge="...",target_device="..."} |
| 32 | libvirt_domain_interface_stats_transmit_drops_total{domain="...",uuid="...",source_bridge="...",target_device="..."} |
| 33 | libvirt_domain_interface_stats_transmit_errors_total{domain="...",uuid="...",source_bridge="...",target_device="..."} |
| 34 | libvirt_domain_interface_stats_transmit_packets_total{domain="...",uuid="...",source_bridge="...",target_device="..."} |
| 35 | libvirt_up |
| 36 | ``` |
| 37 | |
| 38 | With the `--libvirt.export-nova-metadata` flag, it will export the following additional OpenStack-specific labels for every domain: |
| 39 | |
| 40 | - name |
| 41 | - flavor |
| 42 | - project_name |
| 43 | |
| 44 | At Kumina we want to perform a single build of this exporter, deploying |
| 45 | it to a variety of Linux distribution versions. This is why this |
| 46 | repository contains a shell script, `build_static.sh`, that builds a |
| 47 | statically linked copy of this exporter in an Alpine Linux based |
| 48 | container. |