°Ô½Ã¹° 42°Ç
 
[¸ð´ÏÅ͸µ1]¿ë·®,dmesg,message
±Û¾´ÀÌ : theko ³¯Â¥ : 2011-08-30 (È­) 09:52 Á¶È¸ : 2196


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

À̸§ Æнº¿öµå
ºñ¹Ð±Û (üũÇÏ¸é ±Û¾´À̸¸ ³»¿ëÀ» È®ÀÎÇÒ ¼ö ÀÖ½À´Ï´Ù.)
¿ÞÂÊÀÇ ±ÛÀÚ¸¦ ÀÔ·ÂÇϼ¼¿ä.
 

miwit.com sir.co.kr DNS Powered by DNSEver.com DNS Powered by DNSEver.com