← All dashboards

Libvirt

This is complete dashboard to monitor libvirt hypervisors and virtual machines

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}"

Dashboard revisions

RevisionDecscriptionCreated

Reviews

Login or Sign up to write a review

Reviews from the community

Get this dashboard

Data source:

Dependencies:

Import the dashboard template:

or

Download JSON

Docs: Importing dashboards

Downloads: 632