[스크립트]

#!/bin/ksh
ADMIN="
xxxxx@xxxx.xx.xx"
ALERT=90
df -k | grep -vE '^Filesystem|tmpfs|cdrom|proc' | awk '{ print $4 " " $7 }' | while read output;
do
echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge $ALERT ]; then
echo "Running out of space ₩"$partition ($usep%)₩" on $(hostname) as on $(date)" |
mail -s "[Alert] Almost out of disk space $usep" $ADMIN
fi
done



[메일 샘플]

메일제목 : [Alert] Almost out of disk space 98
메일내용 : Running out of space "/usr (98%)" on 호스트명 as on Wed Aug  4 12:14:17 KORST 2010






+ Recent posts