File: df.in

package info (click to toggle)
munin 2.0.76-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 7,064 kB
  • sloc: perl: 11,684; java: 1,924; sh: 1,632; makefile: 636; javascript: 365; python: 267
file content (80 lines) | stat: -rw-r--r-- 1,477 bytes parent folder | download | duplicates (5)
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
70
71
72
73
74
75
76
77
78
79
80
#!@@GOODSH@@
# -*- sh -*-

: << =cut

=head1 NAME

df - Script to monitor disk usage

=head1 CONFIGURATION

The following environment variables are used by this plugin:

=over 4

=item warning

Warning percentage (Default: 92)

=item critical

Critical percentage (Default: 98)

=back

=head1 NOTES

=head2 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.

=head2 RESCTRICTIONS

None, unless you have restricted who can use /usr/bin/df.

=head1 AUTHOR

Unknown author

=head1 LICENSE

GPLv2

=head1 MAGIC MARKERS

 #%# family=contrib
 #%# capabilities=autoconf

=cut

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

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

	echo 'graph_title Disk usage in percent'
	echo 'graph_args --upper-limit 100 -l 0'
	echo 'graph_vlabel %'
	echo 'graph_category disk'
	echo 'graph_scale no'
	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 ${warning:-92}"
		echo "$name.critical ${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