分类:
2008-05-11 22:16:12
1、模拟网络故障
cat <<'!' >/tmp/network-down
ifconfig en1 down
ifconfig en0 down
#notice: the seconds must > 360
sleep 600
ifconfig en1 up
ifconfig en0 up
rm -f /tmp/network-down
!
chmod +x /tmp/network-down
nohup /tmp/network-down
说明:ifconfig enX down和真正的拔网线还有点区别,也可以用ifconfig enX detach。
2、模拟单网卡故障
cat <<'!' >/tmp/1adapter-down
ifconfig en0 down
sleep 60
ifconfig en0 up
rm -f /tmp/1adapter-down
!
chmod +x /tmp/1adapter-down
nohup /tmp/1adapter-down
3、模拟节点故障
reboot -q
另外,对上次的脚本做了一点修改,而且也是把下面的东东全粘到TELNET里,两个文件就自动生成了。
cat <<'EOF' >./ha1
#!/usr/bin/ksh
# Use this scrīpt before your adjusting HACMP
# Function: Clear these logs as follow.
cat <<'!' >/tmp/HAlogs
/tmp/hacmp.out
/tmp/clstrmgr.debug
/var/hacmp/clcomd/clcomd.log
/var/hacmp/clcomd/clcomddiag.log
/tmp/cspoc.log
!
suffix=`date +"%y%m%d%H%M%S"`
for i in `cat /tmp/HAlogs`; do (cp $i $i.$suffix 2>/dev/null); done
for i in `cat /tmp/HAlogs`; do (> $i); done
EOF
cat <<'EOF' >./ha2
#!/usr/bin/ksh
# Use this scrīpt after your adjusting HACMP
# Function: See which log has alteration.
cat /tmp/HAlogs 2>/dev/null
echo; echo
cat <<'!' >/tmp/HAlogs-result
###############
tail /tmp/hacmp.out 2>/dev/null
###############
tail /tmp/clstrmgr.debug 2>/dev/null
###############
tail /var/hacmp/clcomd/clcomd.log 2>/dev/null
###############
tail /var/hacmp/clcomd/clcomddiag.log 2>/dev/null
###############
cat /tmp/cspoc.log |egrep -p "FAIL|ERROR"
###############
tail /tmp/dms_loads.out 2>/dev/null
###############
tail /tmp/emuhacmp.out 2>/dev/null
###############
grep "Check:" /var/hacmp/clverify/clverify.log |sort |uniq
###############
grep -v "with 0 errors" /var/hacmp/log/clutils.log
###############
tail /var/hacmp/utilities/cl_configassist.log 2>/dev/null
###############
tail /var/ha/log/grpsvcs 2>/dev/null
###############
tail /var/ha/log/topsvcs 2>/dev/null
###############
cat /usr/es/adm/cluster.log |grep "`date |awk '{print $2,$3}'`" |grep err |egrep -v "(public|repeated)"
###############
alog -o -f '/var/adm/ras/conslog' |grep "`date |awk '{print $2,$3}'`" |tail
###############
errpt | grep " `date +%m%d`"
!
ksh -v /tmp/HAlogs-result
echo; echo
rm -f /tmp/HAlogs
rm -f /tmp/HAlogs-result
EOF
chmod a+x ha[12]