~ubuntu-branches/ubuntu/gutsy/munin/gutsy

« back to all changes in this revision

Viewing changes to node/node.d/df.in

  • Committer: Bazaar Package Importer
  • Author(s): Tore Anderson
  • Date: 2004-05-21 20:51:19 UTC
  • Revision ID: james.westby@ubuntu.com-20040521205119-oz8bllbjp9hs80ig
Tags: upstream-0+1.0.0pre5
ImportĀ upstreamĀ versionĀ 0+1.0.0pre5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Script to monitor disk usage.
 
4
#
 
5
# Parameters understood:
 
6
#
 
7
#       config   (required)
 
8
#       autoconf (optional - used by munin-config)
 
9
#
 
10
# $Log: df.in,v $
 
11
# Revision 1.3  2004/01/29 19:39:00  jimmyo
 
12
# Generic plugins now use printf instead of echo -n, as this is more portable (SF#885564)
 
13
#
 
14
# Revision 1.2  2004/01/29 18:57:39  jimmyo
 
15
# Disabled plugins df and df_inode on Solaris (SF#882274).
 
16
#
 
17
# Revision 1.1  2004/01/02 18:50:00  jimmyo
 
18
# Renamed occurrances of lrrd -> munin
 
19
#
 
20
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
 
21
# Import of LRRD CVS tree after renaming to Munin
 
22
#
 
23
# Revision 1.6  2003/11/07 17:43:16  jimmyo
 
24
# Cleanups and log entries
 
25
#
 
26
#
 
27
#
 
28
# Magic markers (optional - used by munin-config and installation
 
29
# scripts):
 
30
#
 
31
#%# family=auto
 
32
#%# capabilities=autoconf
 
33
 
 
34
MAXLABEL=20
 
35
 
 
36
if [ "$1" = "autoconf" ]; then
 
37
        if [ `uname -s` = SunOS ]; then
 
38
                echo no
 
39
                exit 1
 
40
        else
 
41
                echo yes
 
42
                exit 0
 
43
        fi
 
44
fi
 
45
 
 
46
if [ "$1" = "config" ]; then
 
47
 
 
48
        echo 'graph_title Filesystem usage (in %)'
 
49
        echo 'graph_args --upper-limit 100 -l 0'
 
50
        echo 'graph_vlabel %'
 
51
        df -P -l  | tail +2 | grep -v "//" | while read i; do
 
52
                name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $1 }'`
 
53
                printf "$name.label "
 
54
                echo $i | awk "{ 
 
55
                        dir=\$6
 
56
                        if (length(dir) <= $MAXLABEL)
 
57
                                print dir
 
58
                        else
 
59
                                printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3)) 
 
60
                }"
 
61
                echo "$name.warning 92"
 
62
                echo "$name.critical 98"
 
63
        done
 
64
        exit 0
 
65
fi
 
66
 
 
67
df -P -l | tail +2 | grep -v "//" | while read i; do
 
68
        name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $1 ".value " }'`
 
69
        printf "$name "
 
70
        echo $i | awk '{ print $5 }' | cut -f1 -d%
 
71
done