|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/local/src/munin-1.2.6/node/node.d/ |
Upload File : |
#!@@GOODSH@@
# -*- sh -*-
#
# $Id: df_inode.in 1415 2008-01-26 21:52:41Z matthias $
#
# Plugin to monitor inode-usage.
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# Environment:
# warning Warning percentage, default 92
# critical Critical percentage, default 98
#
# 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 | sed 1d | grep -v "//" | while read i; do
if [ "`fs $i`" = "reiserfs" ] ; then continue ; fi
name=`echo $i | sed 's/[\/.]/_/g'| awk '{ print $1 ".value " }'`
printf "$name "
echo $i | awk '{ print $5 }' | cut -f1 -d%
done
}
if [ "$1" = "autoconf" ]; then
if [ "`print_values`" = "" ] ; then
echo no
exit 1
else
if [ `uname -s` = SunOS ]; then
echo no
exit 1
else
echo yes
exit 0
fi
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 %'
df -P -l -i | sed 1d | grep -v "//" | sort | while read i; do
if [ "`fs $i`" = "reiserfs" ] ; then continue ; fi
name=`echo $i | sed 's/[\/.]/_/g'| awk '{ print $1 }'`
printf "$name.label "
echo $i | awk "{
dir=\$6
if (length(dir) <= $MAXLABEL)
print dir
else
printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
}"
echo "$name.warning ${warning:-92}"
echo "$name.critical ${critical:-98}"
done
exit 0
fi
print_values