[스크립트]
#!/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
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
'::: OS ::: > AIX' 카테고리의 다른 글
errpt 백업 및 삭제 (0) | 2010.09.07 |
---|---|
접속계정 강제 로그아웃 (0) | 2010.08.19 |
AIX 에서 TCP wrapper 사용하기 (0) | 2010.07.22 |
pGraph (1) | 2010.05.13 |
AIX 환경에서 특정 날짜에 생성된 로그를 찾아 자동으로 압축하여 보관 (0) | 2010.05.12 |