mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
Renamed back to lvm_
This commit is contained in:
parent
005ab0c7f5
commit
60e9f79c65
1 changed files with 0 additions and 0 deletions
70
plugins/disk/lvm_
Executable file
70
plugins/disk/lvm_
Executable file
|
@ -0,0 +1,70 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Script to monitor disk usage.
|
||||
#
|
||||
# By PatrickDK
|
||||
#
|
||||
# Parameters understood:
|
||||
#
|
||||
# config (required)
|
||||
# autoconf (optional - used by munin-config)
|
||||
# suggest
|
||||
#
|
||||
# Needs to be run as root, so the following needs to be added to the config:
|
||||
#
|
||||
# [lvm_]
|
||||
# user root
|
||||
#
|
||||
# $Log$
|
||||
#
|
||||
# Magic markers (optional - used by munin-config and installation
|
||||
# scripts):
|
||||
#
|
||||
#%# family=auto
|
||||
#%# capabilities=autoconf suggest
|
||||
|
||||
if [ "$1" = "autoconf" ]; then
|
||||
echo yes
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$1" = "suggest" ]; then
|
||||
vgs -o vg_name --noheadings | sed -e 's/\ *//'
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
vg=`echo $0 | awk '{ sub(".*lvm_","",\$1); print \$1; }'`
|
||||
|
||||
clean_name() {
|
||||
echo $1 | sed 's/[\/.-]/_/g'
|
||||
}
|
||||
|
||||
|
||||
if [ "$1" = "config" ]; then
|
||||
|
||||
echo 'graph_title Logical Volume usage'
|
||||
echo 'graph_args --base 1024 -l 0'
|
||||
# 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
|
Loading…
Add table
Add a link
Reference in a new issue