nagios plugin for checking a directory for count of file. You need to give two argument first for directory and second for file count.
PROGNAME=`basename $0`
PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
. $PROGPATH/utils.sh
SEARCH=$1
MAX=$2
COUNT=$(find $1 | wc -l| sed -e 's/ //g')
if [[ $COUNT -gt $MAX ]]
then
echo "NOK " $SEARCH $COUNT "|" $SEARCH"COUNT="$COUNT";;;;"
exit $STATE_CRITICAL
else
echo "OK " $SEARCH $COUNT "|" $SEARCH"COUNT="$COUNT";;;;"
exit $STATE_OK
fi
Wednesday, 29 April 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment