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 81 82 83 84 85
|
#!@@GOODSH@@
# -*- sh -*-
: << =cut
=head1 NAME
df - Script to monitor disk usage
=head1 APPLICABLE SYSTEMS
Cygwin 1.7.x or higher systems with coreutils installed.
=head1 USAGE
Link this plugin to @@CONFDIR@@/plugins/ and restart the munin-node.
The plugin excludes per default the following special, read-only or
dynamically allocating file systems from graphing:
iso9660
=head1 CONFIGURATION
The following environment variables are used by this plugin:
warning - Warning percentage (Default: 92)
critical - Critical percentage (Default: 98)
=head1 BUGS/TODO
Check smb/cifs remote mounts. (Cygwin bug, 2002 vintage, still unfixed: -l switch to df is reversed.)
=head1 AUTHOR
Erik Inge Bolsø <knan-munin@anduin.net>
=head1 LICENSE
GPLv2
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=cut
. "$MUNIN_LIBDIR/plugins/plugin.sh"
print_values () {
df -P -x iso9660 2>/dev/null | sed -e 1d -e '/\/\//d' -e 's/%//' |
while read -r dev size used free pct fs; do
echo "$(clean_fieldname "$dev").value $pct"
done
}
if [ "$1" = "autoconf" ]; then
if [ -z "$(print_values)" ] ; then
echo no
else
echo yes
fi
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_scale no'
echo 'graph_category disk'
# shellcheck disable=SC2034
df -P -x iso9660 | sed -e 1d -e '/\/\//d' -e 's/%//' | sort \
| while read -r dev size used free pct fs; do
name=$(clean_fieldname "$dev")
echo "$name.label $fs"
print_warning "$name"
print_critical "$name"
done
exit 0
fi
print_values
|