File: df.in

package info (click to toggle)
munin 1.2.3-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,940 kB
  • ctags: 98
  • sloc: sh: 4,215; makefile: 452; perl: 135
file content (69 lines) | stat: -rwxr-xr-x 1,714 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/sh
#
# Script to monitor disk usage.
#
# $Log$
# Revision 1.2  2004/05/18 22:04:29  jimmyo
# Use "sed 1d" instead of "tail +2" in df plugins (patch by Olivier Delhomme).
#
# Revision 1.1  2004/01/02 18:50:00  jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.2  2003/11/07 17:43:16  jimmyo
# Cleanups and log entries
#
#
#
#   DESCRIPTION
#   ===========
#     This will report back the sizes of the filesystems currently
#     mounted.  All measurements are reported in percents, not in actual
#     512KB pages.  It uses /usr/bin/df.
#     
#   RESCTRICTIONS
#   =============
#     Unless you've restricted who can use /usr/bin/df then there are none.
#
# Parameters understood:
#
# 	config   (required)
# 	autoconf (optional - used by munin-config)
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=contrib
#%# capabilities=autoconf




if [ "$1" = "autoconf" ]; then
	echo yes
	exit 0
fi

if [ "$1" = "config" ]; then

	echo 'graph_title Filesystem usage (in %)'
	echo 'graph_args --upper-limit 100 -l 0'
	echo 'graph_vlabel %'
	df -P -k | sed 1d | grep -v "//" | grep -v "nfs" | while read i; do
		name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $6 }'`
		devName="$name.label "
		fsLabel=`echo $i | awk '{ print $6 }'`
                echo $devName$fsLabel
		echo "$name.warning 92"
		echo "$name.critical 98"
	done
	exit 0
fi

df -P -k | sed 1d | grep -v "//" | grep -v "nfs" | while read i; do
	name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $6 ".value " }'`
	name2=`echo $i | awk '{ print $5 }' | cut -f1 -d%`
        echo $name $name2
done