Skip to content

Instantly share code, notes, and snippets.

@pmoranga
Created June 20, 2011 14:23
Show Gist options
  • Save pmoranga/1035686 to your computer and use it in GitHub Desktop.
Save pmoranga/1035686 to your computer and use it in GitHub Desktop.
Graph % of used space of LVM Snapshot
#!/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
if [ "$1" = "autoconf" ]; then
/usr/sbin/lvdisplay 2>/dev/null >/dev/null
if [ $? -eq 0 ]
then
echo yes
exit 0
else
echo "no lvdisplay found"
fi
exit 1
fi
if [ "$1" = "config" ]; then
echo 'graph_title Allocated space for snapshot (%)'
echo 'graph_vlabel %'
echo 'graph_category disk'
echo 'graph_args --upper-limit 100 -l 0'
/usr/sbin/lvdisplay -C | awk '$3 ~ /^s/{print $1".label "$1" snapshot of "$5; print $1".warning 92";print $1".critical 98"} '
exit 0
fi
/usr/sbin/lvdisplay -C | awk '$3 ~ /^s/{print $1".value",int($6)} '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment