Libvirt

Dashboard

This is complete dashboard to monitor libvirt hypervisors and virtual machines
Last updated: 2 years ago

Start with Grafana Cloud and the new FREE tier. Includes 10K series Prometheus or Graphite Metrics and 50gb Loki Logs

Downloads: 157

Reviews: 0

  • general_1.png
    general_1.png
  • general_2.jpg
    general_2.jpg
  • blockstats_1.jpg
    blockstats_1.jpg
  • blockstats_2.jpg
    blockstats_2.jpg

General info

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

Libvirt Exporter

  • sources: https://github.com/bykvaadm/libvirt_exporter_improved
  • docker: https://hub.docker.com/r/bykva/libvirt-exporter
  • run: docker run -ti -p 9177:9177 -v /run/libvirt/libvirt-sock-ro:/var/run/libvirt/libvirt-sock-ro:ro bykva/libvirt-exporter:1.0

Node Exporter

  • sources and docs: https://github.com/prometheus/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}"
Get this dashboard:
13633
Dependencies: