Chinaunix首页 | 论坛 | 博客
  • 博客访问: 19268768
  • 博文数量: 7460
  • 博客积分: 10434
  • 博客等级: 上将
  • 技术积分: 78178
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-02 22:54
文章分类

全部博文(7460)

文章存档

2011年(1)

2009年(669)

2008年(6790)

分类:

2008-05-11 22:16:12

做HACMP切换实验的时候,如果进展不顺利,那就总要去机房插拔网线,太累,干脆用脚本模拟吧。现在只要把脚本粘到TELNET里就好了,方便多了。

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]

阅读(1180) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~