Build precise queries to find exactly what you need
Press ESC to close
Had errors running the script. I modified it for
#!/bin/bash
# Return codes:
STATE_OK=0
STATE_WARNING=1
STATE_CRITICAL=2
STATE_UNKNOWN=3
# Arguments:
DIRECTORY=$1
WARNLEVEL=$2
CRITLEVEL=$3
# Get current file count:
FCOUNT=`ls -l $DIRECTORY |grep -v tot* |wc -l`
#echo “Total files in $DIRECTORY is $FCOUNT”
if [ $FCOUNT -lt $WARNLEVEL ]; then
echo “OK, $FCOUNT items in $DIRECTORY|files=$FCOUNT”
exitstatus=$STATE_OK
exit $exitstatus fi if [ $FCOUNT -gt $CRITLEVEL ]; then
echo “CRITICAL: $FCOUNT items in $DIRECTORY|files=$FCOUNT”
exitstatus=$STATE_CRITICAL
exit $exitstatus fi if [ $FCOUNT -gt $WARNLEVEL ]; then
echo “WARNING: $FCOUNT items in $DIRECTORY|files=$FCOUNT”
exitstatus=$STATE_WARNING
exit $exitstatus fi
and it works fine
We’ve completely redesigned the world’s largest repository of Nagios plugins and monitoring tools. Join thousands of users sharing monitoring solutions for servers, applications, and everything in between.
Due to our redesign, all existing accounts require a password reset to access your account again.
Ready to explore 6,100+ projects and contribute to the community?
Reset Password Create Account
Happy Monitoring!