#!/bin/ksh
#===================================================================#
# #
# Name : check_filesystems.sh #
# Synopsis : Checks that no filesystems have breached the #
# hard-coded percentage fill limit (currently 90%). #
# To change the threshold, replace both occurences of #
# 90 to the figure of your choice. #
# Source : http://www.oracle-dba.fr.pl #
# #
#===================================================================#
#--------------------------------------------------------------------
# CONSTANTS
TEMP_FILE=/tmp/fs_check.txt
TEMP_FILE2=/tmp/fs_check2.txt
#--------------------------------------------------------------------
# MAIN
df -k | awk '{if (NR != 1)
print $5 $6
}' > ${TEMP_FILE}
awk -F"%" '{if ($1 > 90) print "Warning: Filesystem " $2 " over 90% threshold (" $1 "%)"}' ${TEMP_FILE} > ${TEMP_FILE2}
if [ -s ${TEMP_FILE2} ]; then
mailx -s "Filesystem threshold breached" oracle < ${TEMP_FILE2}
fi
rm ${TEMP_FILE}
rm ${TEMP_FILE2}