2008-07-25 23:53:08 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Script to monitor disk usage.
|
|
|
|
#
|
|
|
|
# By PatrickDK
|
|
|
|
#
|
|
|
|
# Parameters understood:
|
|
|
|
#
|
|
|
|
# config (required)
|
|
|
|
# autoconf (optional - used by munin-config)
|
|
|
|
#
|
|
|
|
# $Log$
|
|
|
|
#
|
|
|
|
# Magic markers (optional - used by munin-config and installation
|
|
|
|
# scripts):
|
|
|
|
#
|
|
|
|
#%# family=auto
|
|
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2012-07-23 16:03:19 +02:00
|
|
|
vg=`echo $0 | awk '{ sub(".*lvm","",\$1); print \$1; }'`
|
2008-07-25 23:53:08 +02:00
|
|
|
|
|
|
|
clean_name() {
|
|
|
|
echo $1 | sed 's/[\/.-]/_/g'
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
|
|
|
|
echo 'graph_title Logical Volume usage'
|
2012-07-23 16:44:00 +02:00
|
|
|
echo 'graph_args --base 1024 -l 0'
|
2008-07-25 23:53:08 +02:00
|
|
|
# echo 'graph_vlabel %'
|
|
|
|
echo 'graph_category disk'
|
|
|
|
echo 'graph_info This graph shows disk usage on the machine.'
|
|
|
|
echo "free.label free"
|
|
|
|
echo "free.draw AREA"
|
|
|
|
lvs --units b --nosuffix --noheadings | grep "$vg" | while read i; do
|
|
|
|
name=`clean_name $i`
|
|
|
|
echo -n "$name.label "
|
|
|
|
echo $i | awk '{ print $1 }'
|
|
|
|
echo "$name.draw STACK"
|
|
|
|
done
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
i=`vgs --units b --nosuffix --noheadings | grep "$vg"`
|
|
|
|
echo -n "free.value "
|
|
|
|
echo $i | awk '{ print $7 }'
|
|
|
|
|
|
|
|
lvs --units b --nosuffix --noheadings | grep "$vg" | while read i; do
|
|
|
|
name=`clean_name $i`
|
|
|
|
echo -n "$name.value "
|
|
|
|
echo $i | awk '{ print $4 }'
|
|
|
|
done
|