Libvirt
1,914

Created 12/24/2020
Updated 12/24/2020
Revision 1
Categories
Host Metrics
Grafana Version >=7.3.5
Datasources
PrometheusPrometheus

General info

This dashboard uses two exporters: libvirt exporter and node_exporter with textfile_exporter

Libvirt Exporter

Node Exporter

TextFile Exporter (part of node exporter)

to obtain lvm information we use additional node_exporter flag: --collector.textfile.directory=/var/prometheus/textfile_exporter

and cronjob which runs this script:

#!/bin/bash

if [ "$(id -u)" != "0" ] ; then echo "Please run as root" >&2; exit 1 ; fi

prom_file="lvm_exporter.prom"
TEXTFILE_COLLECTOR_DIR="/var/prometheus/textfile_exporter"
rm ${TEXTFILE_COLLECTOR_DIR}/${prom_file}.* 2>/dev/null || true

echo "# HELP node_lvs_size_bytes LVM size in bytes(IEC) of lvm volumes" >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"
echo "# TYPE node_lvs_size_bytes gauge" >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"
/usr/sbin/lvs --units b | awk 'FNR>1 {print "node_lvs_size_bytes{lv=\""$1"\",vg=\""$2"\"} "substr($4, 1, length($4)-1)}' >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"

echo "# HELP node_vgs_size_bytes LVM size in bytes(IEC) of lvm volume groups" >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"
echo "# TYPE node_vgs_size_bytes gauge" >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"
/usr/sbin/vgs --units b | awk 'FNR>1 {print "node_vgs_size_bytes{vg=\""$1"\"} "substr($6, 1, length($6)-1)}' >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"

echo "# HELP node_vgs_free_bytes LVM free space of lvm volume groups in bytes(IEC)" >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"
echo "# TYPE node_vgs_free_bytes gauge" >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"
/usr/sbin/vgs --units b | awk 'FNR>1 {print "node_vgs_free_bytes{vg=\""$1"\"} "substr($7, 1, length($7)-1)}' >> "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$"

mv "${TEXTFILE_COLLECTOR_DIR}/${prom_file}.$$" "${TEXTFILE_COLLECTOR_DIR}/${prom_file}"
Export Dashboard
Download
Copy to Clipboard

Used Metrics 21

  • libvirt_domain_memory_stats_available

  • libvirt_domain_memory_stats_used_percent

  • libvirt_domain_block_stats_physicalsize

  • node_cpu_seconds_total

  • node_vgs_size_bytes

  • node_vgs_free_bytes

  • node_memory_MemFree_bytes

  • libvirt_domain_info_maximum_memory_bytes

  • libvirt_domain_info_memory_usage_bytes

  • libvirt_domain_info_virtual_cpus

  • libvirt_domain_info_vstate

  • libvirt_domain_block_stats_write_requests_total

  • libvirt_domain_block_stats_read_requests_total

  • libvirt_domain_block_stats_write_time_total

  • libvirt_domain_block_stats_read_time_total

  • libvirt_domain_block_stats_write_bytes_total

  • libvirt_domain_block_stats_read_bytes_total

  • libvirt_domain_block_stats_flush_requests_total

  • libvirt_domain_block_stats_flush_total

  • libvirt_domain_block_stats_allocation

  • libvirt_domain_block_stats_capacity