Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
df -Pk | awk '$3 ~ /[0-9]/ { print $1,"\t",$3,"\t",substr($5,1,index($5,"%")-1)
}' > df.out
set -A new1 $( awk ' {print $1}' df.out )
set -A new2 $( awk ' {print $2}' df.out )
set -A new3 $( awk ' {print $3}' df.out )
if [[ ! -s out ]]
then
j=0;
cat /dev/null > out
while [[ $j -lt ${#new1[*]} ]]
do
print "${new1[$j]}\t${new2[$j]}" >> out
((j+=1))
done
fi
set -A old1 $( awk ' {print $1}' out )
set -A old2 $( awk ' {print $2}' out )
cat /dev/null > email.txt
i=0;
while [[ $i -lt ${#old1[*]} ]]
do
j=0;
while [[ $j -lt ${#new1[*]} ]]
do
if [[ ${old1[$i]} = ${new1[$j]} ]]
then
if [[ ${old2[$i]} -lt ${new2[$j]} ]]
then
(( temp = ${new2[$j]} - ${old2[$i]} ))
print "${old1[$i]} was increased in size by ${temp}KByte" >> email.txt
break
fi
fi
((j+=1))
done
((i+=1))
done
j=0;
cat /dev/null > out
while [[ $j -lt ${#new1[*]} ]]
do
# This if statement is for Handling exceptions
#(where not to check for higher than 95% filesystems)
if [[ ${new1[$j]} != "test:/orastg" ]]
then
if [[ ${new3[$j]} -ge 95 ]]
then
print "WARNING: ${new1[$j]} is ${new3[$j]}% utilized!!!" >> email.txt
fi
fi
print "${new1[$j]}\t${new2[$j]}" >> out
((j+=1))
done
#cat email.txt
if [[ -s email.txt ]]
then
mail -s "Daily Status Report" "khalid@company.com" < email.txt
fi
# History
echo "======================================================================" >>
history.out
date >> history.out
echo "======================================================================" >>
history.out
cat email.txt >> history.out
echo "======================================================================" >>
history.out
df -Pg >> history.out
# Maintain the size of the history.out file to be 3000 lines only
tail -3000 history.out > temp.out
mv temp.out history.out
MAILTO="tom@lala.org"
THRESHOLD=95
TMP_FILE=/tmp/platz.bla.tmp
## Add additional EXCLUDES with '|'
EXCLUDES='proc|mnt'
df | \
grep -vE "\/$EXCLUDES" | \
awk -v threshold=$THRESHOLD '
BEGIN {
# Create the header
printf("%-50s%6s\n","Filesystem:","Filled:")
}
# Check which NF has the "%Used"
NR == 1 {
for (z=1; z < NF; z++) {
if ( $z == "%Used" ) {field=z}
}
}
NR > 1 {
filled=substr($feld,0,length($feld)-1)
if ( filled >= threshold ) {
printf("%-50s%6s\n",$NF,$field)
}
}' > $TMP_FILE
if [[ -e $TMP_FILE && `wc -l $TMP_FILE| awk '{print $1}'` -gt 1 ]]; then
mail -s "Check filesystems - look at the mail body for details." $MAILTO < $TMP_FILE
else
echo "Nothing happened."
fi
exit 0