2011-06-20 16:26:23 +02:00
|
|
|
#!/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 17:07:41 +01:00
|
|
|
#
|
|
|
|
# 2012/01/27 - Sébastien Gross
|
|
|
|
# - Fix lvdisplay path
|
|
|
|
|
|
|
|
lvdisplay=$(which lvdisplay)
|
2011-06-20 16:26:23 +02:00
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
2012-01-27 17:07:41 +01:00
|
|
|
if test -n "${lvdisplay}"; then
|
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
echo "no lvdisplay found"
|
|
|
|
exit 1
|
2011-06-20 16:26:23 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
echo 'graph_title Allocated space for snapshot'
|
|
|
|
echo 'graph_vlabel %'
|
|
|
|
echo 'graph_category disk'
|
|
|
|
echo 'graph_args --base 100'
|
2012-01-27 17:07:41 +01:00
|
|
|
${lvdisplay} -C | awk '$3 ~ /^s/{print $1".label "$1" snapshot of "$5} '
|
2011-06-20 16:26:23 +02:00
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2012-01-27 17:07:41 +01:00
|
|
|
${lvdisplay} -C | awk '$3 ~ /^s/{print $1".value",int($6)} '
|