Projet

Général

Profil

Révision 1e2bbe77

ID1e2bbe775e30b4f9fd1127124cc3cbbf71d33f90
Parent d42751c9
Enfant ff327623

Ajouté par Ken-ichi Mito il y a plus de 9 ans

fix - add clean_fieldname to make field name safe

  • lvm_: only add clean_fieldname
  • lvm_snap_used * add clean_fieldname * force y-axis scale to 0-100 %

Voir les différences:

plugins/disk/lvm_
44 44

  
45 45
EOF
46 46

  
47
. $MUNIN_LIBDIR/plugins/plugin.sh
48

  
49

  
47 50
if [ "$1" = "autoconf" ]; then
48 51
    if ! command -v lvs >/dev/null; then
49 52
        echo "no (lvs not found)"
......
64 67
vg=`echo $0 | awk '{ sub(".*lvm_","",\$1); print \$1; }'`
65 68

  
66 69
clean_name() {
67
    echo $1 | sed 's/[\/.-]/_/g'
70
    echo "$(clean_fieldname "$1")"
68 71
}
69 72

  
70 73

  
plugins/disk/lvm_snap_used
18 18
# 2012/01/27 - Sébastien Gross
19 19
#            - Fix lvdisplay path
20 20

  
21

  
22
. $MUNIN_LIBDIR/plugins/plugin.sh
23

  
21 24
lvdisplay=$(which lvdisplay)
22 25

  
23 26
if [ "$1" = "autoconf" ]; then
......
35 38
	echo 'graph_title Allocated space for snapshot' 
36 39
	echo 'graph_vlabel %'
37 40
	echo 'graph_category disk'
38
	echo 'graph_args --base 100'
39
         ${lvdisplay} -C | awk '$3 ~ /^s/{print $1".label "$1" snapshot of "$5} '
40
	exit 0
41
	echo 'graph_args -l 0 -u 100 -r'
41 42
fi
42 43

  
43 44

  
44
${lvdisplay} -C | awk '$3 ~ /^s/{print $1".value",int($6)} '
45
${lvdisplay} -C | awk '$3 ~ /^s/{print}' | while read line; do
46
    name="$(echo $line | awk '{print $1}')"
47
    id="$(clean_fieldname "$name")"
48
    origin="$(echo $line | awk '{print $5}')"
49
    origin="$(clean_fieldname "$origin")"
50
    percent="$(echo $line | awk '{print $6}')"
51
    
52
    if [ "$1" = "config" ]; then
53
        echo "$id.label $name snapshot of $origin"
54
    else
55
        echo "$id.value $percent"
56
    fi
57
done

Formats disponibles : Unified diff