PLUGINDIR=plugins
INSTALL=/usr/bin/install
DSTPLUGINDIR=$(DESTDIR)/usr/share/munin/plugins
+CONFDIR=conf
+DSTCONFDIR=$(DESTDIR)/etc/munin/plugin-conf.d
build:
# no-op
install:
$(INSTALL) -d $(DSTPLUGINDIR)
$(INSTALL) -m 0755 $(PLUGINDIR)/* $(DSTPLUGINDIR)
+ $(INSTALL) -d $(DSTCONFDIR)
+ $(INSTALL) -m 0755 $(CONFDIR)/* $(DSTCONFDIR)
.PHONY: install
+munin-plugins-local (0.10~test.0) UNRELEASED; urgency=medium
+
+ * Add lvmcache_ plugin, for graphing lvm cache state
+
+ -- Michael Howe <michael@michaelhowe.org> Sat, 16 Dec 2017 22:12:26 +0000
+
munin-plugins-local (0.9) unstable; urgency=low
* Fix snmp__sky_router_ not showing the total number of devices
--- /dev/null
+#!/bin/bash
+#
+# Plugin to get LVM cache states. See lvmcache(7) for further details.
+#
+# Heavily based on <https://github.com/SweBarre/munin-lvm/blob/master/vg_>
+
+# Magic markers
+
+#%# family=auto
+#%# capabilities=autoconf suggest
+
+set -e
+
+VOLUMEGROUP=${0##*lvmcache_}
+VOLUMEGROUP=${VOLUMEGROUP%%_*}
+LOGICALVOLUME=${0##*${VOLUMEGROUP}_}
+
+[ -z "$LVS" ] && LVS="$(which lvs)"
+if [ ! -x "$LVS" ]; then
+ echo "Error - cannot find an executable lvs" >&2
+ exit 1
+fi
+
+export LVS
+
+do_ () {
+ LV_OUTPUT=( $($LVS --noheading --unit b --nosuffix --options lv_name,cache_total_blocks,cache_used_blocks,cache_read_hits,cache_read_misses,cache_write_hits,cache_write_misses,cache_dirty_blocks "$VOLUMEGROUP/$LOGICALVOLUME") )
+ echo "blks_total.value ${LV_OUTPUT[1]}"
+ echo "blks_used.value ${LV_OUTPUT[2]}"
+ echo "blks_read_hit.value ${LV_OUTPUT[3]}"
+ echo "blks_read_miss.value ${LV_OUTPUT[4]}"
+ echo "blks_write_hit.value ${LV_OUTPUT[5]}"
+ echo "blks_write_miss.value ${LV_OUTPUT[6]}"
+ echo "blks_dirty.value ${LV_OUTPUT[7]}"
+}
+
+do_autoconf() {
+ [ $LVS ] || { echo "no (lvs not found)"; exit 0; }
+ echo "yes"
+ exit 0
+}
+
+do_suggest () {
+ $LVS --noheadings --options vg_name,lv_name,cache_total_blocks | awk '$3 ~ /.+/ {print $1 "_" $2 }'
+}
+
+do_config () {
+ cat <<EOF
+graph_title LVM cache state $VOLUMEGROUP/$LOGICALVOLUME
+graph_info Cache information about $VOLUMEGROUP/$LOGICALVOLUME
+graph_vlabel bytes
+graph_category disk
+graph_args --base 1024 -l 0
+graph_scale yes
+blks_total.label Total blocks
+blks_total.draw LINE1
+blks_used.label Used blocks
+blks_used.draw LINE1
+blks_read_hit.label Cache read hits
+blks_read_hit.draw LINE1
+blks_read_miss.label Cache read misses
+blks_read_miss.draw LINE1
+blks_write_hit.label Cache write hits
+blks_write_hit.draw LINE1
+blks_dirty.label Dirty blocks
+blks_dirty.draw LINE1
+EOF
+}
+
+do_$1