[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: monitoring disk space to syslog



Shri Shrikumar wrote:

Hi list,

Is there any tool that will monitor disk space on the machine and write
a line to the syslog if any of the partitions have less than a specified
amount of disk space so that logcheck can flag it up for me.

Thanks and best wishes,

Shri

here's a little script I use for alerts by email. it needs on commandline option, the triggering threshold (in percent), e.g "monitorfs.sh 90"

#!/bin/sh
if test -z $1 ; then exit 1

else
for i in `df -k | grep hd | awk '{print $1}' `; do
FULL=`df -k | grep $i | awk '{print $5}' | cut -d "%" -f 1 `
#echo FULL=$FULL
if test $FULL -ge $1 ; then
       MP=`mount | grep $i | awk '{print $3}'`
echo "$i ($MP) is at $FULL%" | mailx -s "ALERT: FS $i ($MP) running full" root
fi
done
fi



Reply to: