n[1]=1; fs[1]=/; limit1[1]=70; limit2[1]=80;
#!/usr/bin/ksh # Setup the date variables FullDate=`date` Date=`date +%m%d` # Setup the other variables ProgName=checkfilesystem SCRIPTDIR=/local/bin/ LOG=/syslog/filecheck.log TMP=/tmp/${ProgName}.$$ TMP2=/tmp/${ProgName}.${$}.2 MAILSUPPORT="someemail@email.com" # Setup the Node name host=`hostname` #Here are the filesystems which are checked n[1]=1; fs[1]=/; limit1[1]=70; limit2[1]=80; n[2]=2; fs[2]=/var; limit1[2]=80; limit2[2]=90; n[3]=3; fs[3]=/usr; limit1[3]=80; limit2[3]=95; n[4]=4; fs[4]=/tmp; limit1[4]=50; limit2[4]=90; n[5]=5; fs[5]=/home; limit1[5]=70; limit2[5]=90; n[6]=6; fs[6]=/stand; limit1[6]=60; limit2[6]=80; n[7]=7; fs[7]=/opt; limit1[7]=80; limit2[7]=90; #...End of locally modifyable section exec > $LOG 2>&1 for x in ${n[*]} do xfs=${fs[$x]} l1=${limit1[$x]} l2=${limit2[$x]} pctfull=`df -k $xfs|grep allocation |awk '{print $1}'|tr -d '%'` if (( $pctfull > $l2 )); then echo "EMERGENCE EMERGENCY EMERGENCY" echo "$xfs=$pctfull on $host" echo "Check filesystem and solve the problem" echo else if (( $pctfull >= $l1)); then echo "Warning $xfs=$pctfull on $host" echo "Please check the filesystem" echo fi fi done if [[ -s $LOG && -f $LOG ]]; then mailx -s "Filesystem Problem on $host " $MAILSUPPORT < $LOG fi