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 86 87 88 89 90 91 92 93 94 95 96
|
#!/bin/sh
#
# Plugin to monitor inode-usage.
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log$
# Revision 1.6.2.2 2005/03/12 21:35:07 jimmyo
# Correct history loss in linux/{df,df_inode}.
#
# Revision 1.6.2.1 2005/02/16 22:50:14 jimmyo
# linux/df* now ignores bind mounts.
#
# Revision 1.6 2004/12/09 20:27:45 jimmyo
# Sort fields in df*-plugins alphabetically.
#
# Revision 1.5 2004/09/25 22:29:16 jimmyo
# Added info fields to a bunch of plugins.
#
# Revision 1.4 2004/05/20 13:57:12 jimmyo
# Set categories to some of the plugins.
#
# Revision 1.3 2004/05/18 22:04:30 jimmyo
# Use "sed 1d" instead of "tail +2" in df plugins (patch by Olivier Delhomme).
#
# Revision 1.2 2004/05/16 11:23:36 jimmyo
# Bugfix in the linux/df_inode plugin, regarding filesystems without inodes.
#
# Revision 1.1 2004/01/02 18:50:01 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
#
#
#
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
MAXLABEL=20
fs() {
local escaped_mntpt=`echo "$*" | awk '{ print $NF }' | sed 's|/|\\\\/|g'`
awk "/^[^ ]* $escaped_mntpt / { print \$3 }" /proc/mounts | grep -v rootfs
}
print_values() {
df -P -l -i -x none -x unknown | sed 1d | grep -v "//" | awk '$5 ~ /[0-9]%/ {print}' | while read i; do
if [ "`fs $i`" = "reiserfs" ] ; then continue ; fi
name=`echo $i | sed 's/[\/.-]/_/g'| awk '{ print $1 ".value " }'`
echo -n "$name "
echo $i | awk '{ print $5 }' | cut -f1 -d%
done
}
if [ "$1" = "autoconf" ]; then
if [ "`print_values`" = "" ] ; then
echo no
else
echo yes
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Inode usage (in %)'
echo 'graph_args --upper-limit 100 -l 0'
echo 'graph_vlabel %'
echo 'graph_category disk'
echo 'graph_info This graph shows the inode usage for the partitions of types that use inodes.'
df -P -l -i -x unknown -x none -T| sed 1d | grep -v "//" | sort | awk '$6 ~ /[0-9]%/ {print}' | awk "
\$2 !~ /reiserfs/ {
dir=\$7
name=\$1; gsub(/[\/.-]/, \"_\", name);
if (length(dir) <= $MAXLABEL)
print name \".label \" dir
else
printf (\"%s.label ...%s\n\", name, substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
print name \".info \" \$7 \" (\" \$2 \") -> \" \$1;
print name \".warning 92\"
print name \".critical 98\"
}"
exit 0
fi
print_values
|