写的一个健康检查的脚本
[
|
2009/03/17 23:10]
|
2009/03/17 23:10]
export PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
LOGDIR=/tmp/$(hostname)_$(date +"%y%m%d")
test -e $LOGDIR && rm -rf $LOGDIR
mkdir $LOGDIR
SYSINFO=$LOGDIR/0.sysinfo.sh
HAINFO=$LOGDIR/3.hainfo.sh
output(){
echo "###########################################################" >> $1
echo "###### $2 ##########" >> $1
$2 >> $1 2>&1
echo >> $1
}
output "$LOGDIR/1.boot.msg.sh" 'grep -i -e warning -e error /var/log/boot.msg'
tail -5000 /var/log/messages > /tmp/messages
output "$LOGDIR/2.messages.sh" 'grep -i -e emerg -e alert -e crit -e error -e warning /tmp/messages'
output "$SYSINFO" 'top -b -n 1'
output "$SYSINFO" 'last'
output "$SYSINFO" 'free -m'
output "$SYSINFO" 'df -h'
output "$SYSINFO" 'mount'
output "$SYSINFO" 'cat /etc/fstab'
output "$SYSINFO" 'ntpq -p'
output "$SYSINFO" 'ls -al --time-style=long-iso /boot/grub/menu.lst /etc/fstab /etc/hosts /etc/inittab /etc/profile'
output "$SYSINFO" 'chkconfig -l xinetd'
output "$SYSINFO" 'chkconfig -l cron'
output "$SYSINFO" 'chkconfig -l syslog'
output "$SYSINFO" 'chkconfig -l xntpd'
output "$SYSINFO" 'chkconfig -l ntpd'
output "$SYSINFO" 'uptime'
PROOT=$( grep [[:space:]]/[[:space:]] /etc/fstab | awk '{print $1}' )
output "$SYSINFO" "tune2fs -l $PROOT"
output "$SYSINFO" 'cat /etc/SuSE-release'
output "$SYSINFO" 'SPident -v'
output "$SYSINFO" 'netstat -lnpa'
output "$SYSINFO" 'ifconfig -a'
output "$SYSINFO" 'ethtool eth0'
output "$SYSINFO" 'ethtool eth1'
output "$SYSINFO" 'ethtool eth2'
output "$SYSINFO" 'ethtool eth3'
test -e "/proc/net/bonding/bond0" && output "$SYSINFO" 'cat /proc/net/bonding/bond0'
test -e "/proc/net/bonding/bond1" && output "$SYSINFO" 'cat /proc/net/bonding/bond1'
if rpm -q ha
then
output "$HAINFO" 'rpm -V ha'
output "$HAINFO" 'rpm -V hainterface'
output "$HAINFO" '/opt/ha/bin/hastat -a'
fi
if rpm -q cluster
then
output "$HAINFO" 'rpm -V cluster'
output "$HAINFO" 'rpm -V lbinterface'
fi
cd /tmp/
tar zcvf $(hostname).tgz $(hostname)_$(date +"%y%m%d")
ftp -nv << !
open 192.168.0.1
user kook password
bin
cd /tmp
put $(hostname).tgz
bye
exit 0
!
本文链接:http://www.52zhe.cn/read.php/218.htm
本文作者:kook(若就博客内所涉及的技术问题交流,请用下面的MSN或Gmail联系我)
联系方式:(MSN:kook#live.com) (Google talk:kookliu)
没有版权:GNU,转载时请注明“转载人”欠本人一顿饭,来日见面之时兑现!谢谢合作!
IBM的X3755-8877的SLES10安装问题
最近使用的三个多路径映射工具



