Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / disk / lvm @ f051d108

Historique | Voir | Annoter | Télécharger (1,32 ko)

1 531a1882 Patrick Domack
#!/bin/sh
2
#
3
# Script to monitor disk usage.
4
#
5
# By PatrickDK
6
#
7
# Parameters understood:
8
#
9
#       config   (required)
10
#       autoconf (optional - used by munin-config)
11
#
12
# $Log$
13
#
14
# Magic markers (optional - used by munin-config and installation
15
# scripts):
16
#
17
#%# family=auto
18
#%# capabilities=autoconf
19
20
if [ "$1" = "autoconf" ]; then
21
        echo yes
22
        exit 0
23
fi
24
25
vg=`echo $0 | awk '{ sub(".*lvm_","",\$1); print \$1; }'`
26
27
clean_name() {
28
    echo $1 | sed 's/[\/.-]/_/g'
29
}
30
31
32
if [ "$1" = "config" ]; then
33
34
        echo 'graph_title Logical Volume usage'
35
        echo 'graph_args --base 1000 -l 0'
36
#       echo 'graph_vlabel %'
37
        echo 'graph_category disk'
38
        echo 'graph_info This graph shows disk usage on the machine.'
39
        echo "free.label free"
40
        echo "free.draw AREA"
41
        lvs --units b --nosuffix --noheadings | grep "$vg" | while read i; do
42
                name=`clean_name $i`
43
                echo -n "$name.label "
44
                echo $i | awk '{ print $1 }'
45
                echo "$name.draw STACK"
46
        done
47
        exit 0
48
fi
49
50
i=`vgs --units b --nosuffix --noheadings | grep "$vg"`
51
echo -n "free.value "
52
echo $i | awk '{ print $7 }'
53
54
lvs --units b --nosuffix --noheadings | grep "$vg" | while read i; do
55
        name=`clean_name $i`
56
        echo -n "$name.value "
57
        echo $i | awk '{ print $4 }'
58
done