cluster_check



--------------------------------cluster_check_list.conf------------start---------------------

server#1;server#2;https://xxxxxxx/clustercheck.jsp

------------------------------- cluster_check_list.conf-------------end------------------


--------------------------------cluster_check_common.sh------------start---------------------

#!/bin/sh
##############################################################################
# 概要            :
# フェイル名      :cluster_check_common.sh
# 実行ユーザ      :
# 設計者          :
# 入力パラメータ  :なし
##############################################################################


dir_sh=/work/tools/staging/sh
dir_conf=/work/tools/staging/conf

cat $dir_conf/cluster_check_list.conf | while read line
do
arr=(${line//;/ })

     for x in ${arr[2]}; do

        sh $dir_sh/cluster_check.sh ${arr[0]} ${arr[1]} ${arr[2]}

     done
done


--------------------------------cluster_check_common.sh------------end---------------------


--------------------------------cluster_check.sh------------start---------------------

#!/bin/sh
##############################################################################
# 概要            :
# フェイル名      :cluster_check.sh
# 実行ユーザ      :
# 設計者          :
# 入力パラメータ  :$1 $2 $3
##############################################################################

Servername1=$1
Servername2=$2
LB_URL=$3

session_id=`curl --connect-timeout 5 --max-time 10 -v $LB_URL 2>&1 | grep "Session ID" |awk '{print $4}'`
session_id1=`GET http://$Servername1:8080/gis/clustercheck.jsp HTTP/1.0 -H "Cookie: JSESSIONID=$session_id" |grep "Session ID" |awk '{print $4}'`
session_id2=`GET http://$Servername2:8080/gis/clustercheck.jsp HTTP/1.0 -H "Cookie: JSESSIONID=$session_id" |grep "Session ID" |awk '{print $4}'`


echo "session_id=$session_id"
echo "session_id1=$session_id1"
echo "session_id2=$session_id2"

  if [ "$session_id1"x = "$session_id"x ]&&[ "$session_id2"x = "$session_id"x ];then
     echo -e "\033[32m[ $Servername1 and $Servername2 Tomcat cluster is ok.]\033[0m"
  else
     echo -e "\033[31m[ $Servername1 and $Servername2 Tomcat cluster no ok] \033[0m"
  fi

--------------------------------cluster_check.sh------------end---------------------



--------------------------------clustercheck.jsp------------start---------------------


<html><head><title>Tomcat Cluster Check</title></head>
<body>
<h1>Cluster AP#1 Test Page</h1>

<%
out.println("<b>Server Info</b> " +  " : " + request.getLocalAddr());
out.println("<b>Session ID</b> " +  " : " + session.getId());
%>

</body>
</html>


--------------------------------clustercheck.jsp------------end---------------------



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值