mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
2ec4e4c1f7
Some plugins emit wrongly formatted "no" messages or lack the "yes" message on success.
58 lines
1.1 KiB
Bash
Executable File
58 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Plugin to monitor the % of allocated area of a LVM snapshot
|
|
#
|
|
# Parameters:
|
|
#
|
|
# config
|
|
# autoconf
|
|
#
|
|
# Configuration variables
|
|
# no config variables
|
|
#
|
|
#%# family=auto
|
|
#%# capabilities=autoconf
|
|
#
|
|
# 2011/05/20 - pmoranga - initial version
|
|
#
|
|
# 2012/01/27 - Sébastien Gross
|
|
# - Fix lvdisplay path
|
|
|
|
|
|
. $MUNIN_LIBDIR/plugins/plugin.sh
|
|
|
|
lvdisplay=$(which lvdisplay)
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
if test -n "${lvdisplay}"; then
|
|
echo yes
|
|
else
|
|
echo "no (lvdisplay not found)"
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
echo 'graph_title Allocated space for snapshot'
|
|
echo 'graph_vlabel %'
|
|
echo 'graph_category disk'
|
|
echo 'graph_args -l 0 -u 100 -r'
|
|
fi
|
|
|
|
|
|
${lvdisplay} -C | awk '$3 ~ /^s/{print}' | while read line; do
|
|
name="$(echo $line | awk '{print $1}')"
|
|
id="$(clean_fieldname "$name")"
|
|
origin="$(echo $line | awk '{print $5}')"
|
|
origin="$(clean_fieldname "$origin")"
|
|
percent="$(echo $line | awk '{print $6}')"
|
|
|
|
if [ "$1" = "config" ]; then
|
|
echo "$id.label $name snapshot of $origin"
|
|
else
|
|
echo "$id.value $percent"
|
|
fi
|
|
done
|