df, dmesg, message ±â¹ÝÀ¸·Î °£´ÜÇÏ°Ô ¸¸µé¾ú´Ù.
- ±âº»ÀûÀ¸·Î ¸¶½ºÅÍ ¼¹ö°¡ À̽ºÅ©¸³Æ®¸¦ µ¹¸®°í
°¢ ¼¹ö¿¡ ssh ÀÎÁõÀÛ¾÷ÀÌ µÇ¾îÀÖ¾î¾ßÇÑ´Ù.
------------------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
Date=`date | awk '{print $3}'`
HTML=/home/theko/apache/htdocs/index.html
OK=/home/theko/script/df-h/conneting.txt
FAIL=0
echo "" > $HTML
echo "
Development Server Monitering " >> $HTML
echo "
" >> $HTML
echo "
" >> $HTML
for month in `cat /home/theko/script/df-h/month.txt`
do
echo "
$month" >> $HTML
done
echo "
" >> $HTML
echo "
" >> $HTML
echo "
" >> $HTML
date >> $HTML
echo "" >> $HTML
echo "" >> $HTML
for HOST in `grep 10. /etc/hosts | awk '{print $2}'`
do
ssh $HOST "hostname"
echo $? > $OK
normal=`cat $OK`
if [ $normal = $FAIL ]
then
echo " $HOST:`grep $HOST /etc/hosts | awk '{print$1}'` " >> $HTML
ssh $HOST "df -h" >> $HTML
echo "==================================================================================================================
" >> $HTML
echo " dmesg " >> $HTML
ssh $HOST "dmesg |tail -20 | grep -i -e fail -e error" >> $HTML
echo "==================================================================================================================
" >> $HTML
echo " Messages " >> $HTML
echo "==================================================================================================================
" >> $HTML
ssh $HOST "tail -20 /var/log/messages | grep -i -e fail -e error" >> $HTML
echo "==================================================================================================================
" >> $HTML
echo "" >> $HTML
echo "" >> $HTML
echo "" >> $HTML
echo "" >> $HTML
else
echo " $HOST:` grep $HOST /etc/hosts | awk '{print$1}'` Conneting Fail!! " >> $HTML
echo "" >> $HTML
echo "" >> $HTML
fi
done
echo "
" >> $HTML
echo "
HOME" > /home/theko/apache/htdocs/$Date.html
tail +37 $HTML >> /home/theko/apache/htdocs/$Date.html