原创

利用shell bash脚本实时监控weblogic运行情况

主要用到了expect远程登录工具用来获取进程id和cpu消耗以及weblogic提供的jar包中weblogic.Admin方法来获取weblogic的运行状态。

详细代码请参考码云代码: https://gitee.com/dcits-pts/WeblogicMonitorBash

如果用java后台写的话也是比较简单的。

testWeblogic.sh

主脚本

#!/bin/bash
#检测weblogic server运行状态
#testWeblogic.sh
#xuwangcheng created 2016.11

#捕捉异常退出
trap "error_exit" 1 2 3 24

###############################################################################
#配置文件
configFile="./test.cfg"

#weblogic信息
weblogicCfg="./testWeblogic.config"

#日志输出文件
logFile="./test.log"

#结果输出文件
resultFile="./result.log"

#关键日志的errorlog
weblogicLog="./weblogic.log"

#搜索weblogci关键日志的关键string
findLogString="<Error>"


#############################################################################
#本地环境weblogic.jar位置
#CLASSPATH

#要检查的weblogic数量
#WEBLOGIC_NUM

#调用webservice接口
#接口地址(不带IP和端口)
#CALL_SERVICE_ADDRESS

#报文
#CALL_MSG


#测试HTTP请求页面地址
#HTTP_URL


#测试HTTP请求返回页面的正确性
#HTTP_VALIDATION_STR

#测试调用接口返回是否正确
#CALL_MSG_VALIDATION_STR

##############################################################
>$logFile
>$resultFile
>lock.lock
>$weblogicLog
rm -f error.lock
#########################################Function########################################

#日志记录
note_log()
{
    local Str=$1
    echo -e "["`date +'%Y-%m-%d %H:%M:%S'`"]$Str" >> $logFile
}


#结果记录
note_result(){
    local Str=$1
    echo -e "$Str" >> $resultFile
}

#退出脚本
my_exit(){
    ti=$1
    if [ $ti -eq 1 ]
    then
        >error.lock
    fi
    rm -f *.temp
    rm -f lock.lock
    note_log "临时文件已删除,脚本已退出"
    exit $ti
}


#异常退出
error_exit(){
    rm -f *.temp
    rm -f lock.lock
    >error.lock
    note_log "脚本异常结束"
    exit 1
}

#检查配置文件
test_cfg(){
    note_log "开始检查配置文件${configFile},${weblogicCfg}"

    if [ ! -f ${configFile} ]
    then
        note_log "${configFile}配置文件不存在,请检查!"
        my_exit 1
    fi

    if [ ! -f ${weblogicCfg} ]
    then
        note_log "${weblogicCfg}配置文件不存在,请检查!"
        my_exit 1
    fi

    cat ${configFile}|sed '/^#/d'|sed '/^$/d' >configFile.temp
    cat ${weblogicCfg}|sed '/^#/d'|sed '/^$/d' >weblogicCfg.temp
}


#读取配置文件,获取全局配置信息
read_cfg(){
    note_log "开始获取全局配置信息"
    fgrep -A7 "[global_cfg]" configFile.temp |sed '1d' > aa.temp

    if [ ! -s aa.temp ]
    then
        note_log "没有获取到[global_cfg]全局配置信息,检查配置文件${configFile}"
        my_exit 1        
    fi

    while read LINE
    do
        eval echo \${$LINE} >/dev/null 2>&1
    done<aa.temp

    note_log "读取全局配置成功"
}

#远程连接主机的工具
testExpect(){
        loginStr=$1
        password=$2
        send_cmd=$3
        expect -c "
        spawn ssh ${loginStr}@${IP};
        expect \"*yes/no*\"  {send \"yes\r\";exp_continue}
        expect \"*password:*\"  {send \"$password\r\"}
        expect \"*from*\"  {send \"$send_cmd\r\"}
        set timeout 2
        send \"exit\r\"
        expect eof
        "
}



#调用webservice
call_service(){
    responseTime=`curl -o /dev/null -s -w %{time_total} -d "${CALL_MSG}" "http://${URL}/${CALL_SERVICE_ADDRESS}"`
    if [ "$?" -eq "0" ]
    then
        note_log "调用接口成功 响应时间 [$responseTime]"
        note_result "${LINE1}.callService.status=OK"
        note_result "${LINE1}.callService.responseTime=$responseTime"
    else
        note_log "调用接口失败。"
        note_result "${LINE1}.callService.status=FAIL"
    fi
}


#检查http返回的页面
call_http(){
    if [ ! "$HTTP_URL" == "" ]
    then
    curl -s ${HTTP_URL}|fgrep -q ${HTTP_VALIDATION_STR}

    if [ $? -eq 0 ]
    then
        note_log "请求HTTP成功,返回正确"
        note_result "${LINE1}.callHttp.status=OK"
    else
        note_log "请求HTTP不成功或者返回了错误的内容"
        note_result "${LINE1}.callHttp.status=FAIL"
    fi
    fi
}


#检查weblogic的详细信息
test_weblogic(){

        note_log "开始检查$URL $DOMAIN_NAME $SERVER_NAME ..."



        IP=`echo $URL|awk -F":" '{print $1}'`
        PORT=`echo $URL|awk -F":" '{print $2}'`

        #远程登陆webllogic主机
        cmd_1="ps auxwh|fgrep -v fgrep|fgrep java"

        note_log "远程登陆主机$IP...执行命令[${cmd_1}]"

        testExpect $LOGIN_STR $LOGIN_PASSWORD "${cmd_1}" >expectlog.temp

        rt=`fgrep "Connection" expectlog.temp` 2>/dev/null
        tt=`fgrep "--help" expectlog.temp` 2>/dev/null
        if [[ -n "$rt" && -z "$tt" ]]
        then
            note_log "远程登录主机$IP失败..."
            continue
        fi

        note_log "登陆主机$IP成功,执行命令[${cmd_1}]成功"

        #获取weblogic的java进程信息和CPU消耗
        cpu_num_1=`cat expectlog.temp|fgrep java|fgrep ${PORT}|awk '{print $3}'`
        #获取PID
        java_pid=`cat expectlog.temp|fgrep java|fgrep ${PORT}|awk '{print $2}'`
        if [ -z $cpu_num_1 ]
        then
            note_log "${IP}主机上面没有发现指定的weblogic的java进程信息,请检查进程是否已挂掉"
            note_result "${LINE1}.java.pid=0"
            continue
        fi

        note_log "当前进程PID${java_pid}消耗主机CPU的百分比为${cpu_num_1}%"    

        note_result    "${LINE1}.java.pid=${java_pid}\n${LINE1}.java.cpu=${cpu_num_1}"

        #获取weblogic关键日志

        #远程登陆webllogic主机
        cmd_2="fgrep -A200 ${findLogString} ${LOG_PATH}"
        note_log "远程登陆主机$IP...执行命令[${cmd_2}]"        
        testExpect $LOGIN_STR $LOGIN_PASSWORD "${cmd_2}" >expectlog.temp

        rt=`fgrep "Connection" expectlog.temp` 2>/dev/null
        tt=`fgrep "--help" expectlog.temp` 2>/dev/null
        if [[ -n "$rt" && -z "$tt" ]]
        then
            note_log "远程登录主机$IP失败..."
            continue
        fi

        note_log "登陆主机$IP成功,执行命令[${cmd_2}]成功"

        echo "[$URL $DOMAIN_NAME $SERVER_NAME $LOG_PATH]">>$weblogicLog

        fgrep -A200 ${findLogString} expectlog.temp >> $weblogicLog

        if [ $? -ne 0 ]
        then
            echo "没有搜索到指定的weblogic日志">>$weblogicLog    
        fi

        note_log "已保存搜索到的weblogic日志,日志路径$weblogicLog"

        note_result "${LINE1}.errorLog=${weblogicLog}"

        #验证是否能够执行weblogic.Admin

        > weblogicStatus.temp
        java weblogic.Admin -url $URL -username $USERNAME -password $PASSWORD get -pretty -mbean "$DOMAIN_NAME:Location=$SERVER_NAME,Name=$SERVER_NAME,Type=ServerRuntime" >/dev/null 2>&1

        if [ $? -ne 0 ]
        then
            note_log "执行命令weblogic.Admin命令失败,请检查环境变量配置"
            note_result "${LINE1}.AdminPermission=FAIL"
            my_exit 1
        fi

        note_result "${LINE1}.AdminPermission=OK"

        java weblogic.Admin -url $URL -username $USERNAME -password $PASSWORD get -pretty -mbean "$DOMAIN_NAME:Location=$SERVER_NAME,Name=$SERVER_NAME,Type=ServerRuntime" >weblogicStatus.temp 

        #检查运行状态
        fgrep -q "State: RUNNING" weblogicStatus.temp

        if [ $? == 0 ]; then
        note_log "检查运行状态Run Status [OK]"
        note_result "${LINE1}.runStatus=OK"
        else
        note_log "检查运行状态Run Status [NOT OK]"
        note_result "${LINE1}.runStatus=NOT OK"
        fi

        #检查健康状态    
        fgrep -q "State:HEALTH_OK" weblogicStatus.temp
        if [ $? == 0 ]; then
        note_log "检查健康状态Health Status [OK]"
        note_result "${LINE1}.healthStatus=OK"
        else
        note_log "检查健康状态Health Status [NOT OK]"
        note_result "${LINE1}.healthStatus=NOT OK"
        fi

        #检查打开的套接字数
        SOCKET_NOW=`cat weblogicStatus.temp | fgrep "OpenSocketsCurrentCount"|awk -F":" '{print $2}'`
        if [ "x$SOCKET_NOW" == "x" ]
        then
        note_log "检查当前套接字数Open Sockets Number [FAIL TO GET]"
        note_result "${LINE1}.openSocketsNumber=FAIL"
        else
            note_log "检查当前套接字数Open Sockets Number [OK] 当前打开数$SOCKET_NOW"
            note_result "${LINE1}.openSocketsNumber=$SOCKET_NOW"
        fi    

        #检查JVM使用情况
        note_log "开始检查当前weblogic的JVM使用情况"
        java weblogic.Admin -url $URL -username $USERNAME -password $PASSWORD get -pretty -type JVMRuntime|head -20 >weblogicStatus.temp

        #当前总大小
        jvm_curr_size=`fgrep "HeapSizeCurrent" weblogicStatus.temp|awk -F":" '{print $2}'`
        #最大值
        jvm_max_size=`fgrep "HeapSizeMax" weblogicStatus.temp|awk -F":" '{print $2}'`
        #当前空闲
        jvm_free_size=`fgrep "HeapFreeCurrent" weblogicStatus.temp|awk -F":" '{print $2}'`
        #空闲百分比
        jvm_free_percent=`fgrep "HeapFreePercent" weblogicStatus.temp|awk -F":" '{print $2}'`

        if [[ -n ${jvm_curr_size} && -n ${jvm_max_size} && -n ${jvm_free_size} && -n ${jvm_free_percent} ]]
        then
            note_log "检查JVM使用情况完毕:"
            note_log "max_size=${jvm_max_size},current_size=${jvm_curr_size},free_size=${jvm_free_size},free_percent=${jvm_free_percent}"
            note_result "${LINE1}.jvm.maxSize=${jvm_max_size}\n${LINE1}.jvm.currentSize=${jvm_curr_size}\n${LINE1}.jvm.freeSize=${jvm_free_size}\n${LINE1}.jvm.freePercent=${jvm_free_percent}"
        else
            note_log "执行weblogic.Admin命令失败,请检查"
            note_result "${LINE1}.jvm=FAIL"
        fi

        #检查队列情况
        note_log "开始检查当前weblogic的队列使用情况"
      java weblogic.Admin -url $URL -username $USERNAME -password $PASSWORD get -pretty -type ExecuteQueueRuntime >weblogicStatus.temp

    #当前空闲线程数   
    queue_free_count=`fgrep "ExecuteThreadCurrentIdleCount" weblogicStatus.temp|awk -F":" '{print $2}'`
    #等待线程数
    queue_pending_count=`fgrep "PendingRequestCurrentCount" weblogicStatus.temp|awk -F":" '{print $2}'`

        if [[ -n ${queue_free_count} && -n ${queue_pending_count} ]]
        then
            note_log "检查队列情况完毕:"
            note_log "free_count=${queue_free_count},pending_count=${queue_pending_count}"
            note_result "${LINE1}.queue.freeCount=${queue_free_count}\n${LINE1}.queue.pendingCount=${queue_pending_count}"
        else
            note_log "执行weblogic.Admin命令失败,请检查"
            note_result "${LINE1}.queue=FAIL"
        fi

        #调用接口
        call_service    

        #请求http
        call_http

}


#检查weblogic
test_step(){

    note_log "开始检查weblogic..."

    #获取检查列表信息
    note_log "获取需要检查的weblogic列表"

    fgrep -A${WEBLOGIC_NUM} "[test_list]" configFile.temp |sed '1d' > aa.temp

    while read LINE1
    do
        unset URL USERNAME PASSWORD DOMAIN_NAME SERVER_NAME LOG_PATH LOGIN_STR LOGIN_PASSWORD
        note_result "[$LINE1]"    

        fgrep -A8 "[${LINE1}]" weblogicCfg.temp | sed '1d' >bb.temp

        if [ ! -s bb.temp ]
        then
            note_log "没有获取到[${LINE1}]标签weblogic的详细信息,请检查配置文件${weblogicCfg},跳过${LINE1}的测试"
            continue        
        fi

        while read LINE2
        do
            eval echo \${$LINE2} >/dev/null 2>&1
        done<bb.temp

        note_result "${LINE1}.url=${URL}"

        note_log "读取[${LINE1}]标签weblogic的详细信息成功:"
        note_log "URL=${URL},USERNAME=${USERNAME},PASSWORD=${PASSWORD},DOMAIN_NAME=${DOMAIN_NAME},SERVER_NAME=${SERVER_NAME},LOG_PATH=${LOG_PATH},LOGIN_STR=${LOGIN_STR},LOGIN_PASSWORD=${LOGIN_PASSWORD}"

        #开始检测
        test_weblogic

    done<aa.temp    


}

###############################################################FUNCTION########################################################

#脚本开始

test_cfg #检查配置文件
read_cfg #读取全局配置信息
test_step #测试方法
my_exit 0  #正常退出

test.cfg

全局配置文件

[test_list]
weblogic_1
weblogic_2
weblogic_3
weblogic_4

[global_cfg]
WEBLOGIC_NUM=4
HTTP_URL=""
HTTP_VALIDATION_STR="<Error>"
CLASSPATH="/weblogic/Oracle/Middleware/wlserver_10.3/server/lib/weblogic.jar:.:/weblogic/jdk1.6.0_45/lib.tools.jar"
CALL_SERVICE_ADDRESS="esbWS/rest/MainService"
CALL_MSG="{ \"ROOT\": { \"REQUEST_METHOD\": \"QryNoInfoByNo\", \"BAT_ID\": \"\", \"SEND_TIME\": \"\", \"REQUEST_INFO\": { \"PHONE_NO\": \"18355193852\", \"OP_CODE\": \"1000\", \"RES_STATUS\": \"0\", \"LOGIN_NO\": \"M3ABB0076\", \"CHECK_FLAG\": \"1\" } } }"
CALL_MSG_VALIDATION_STR="0000"

testWeblogic.config

weblogic服务器的信息

#按照此格式补充多个weblogic



[weblogic_1]
URL=152.55.229.71:51000
USERNAME=weblogic 
PASSWORD=
DOMAIN_NAME=
SERVER_NAME=
LOG_PATH=/chnesb/console51000.log
LOGIN_STR=chnesb
LOGIN_PASSWORD=


[weblogic_2]
URL=152.55.229.72:51000
USERNAME=weblogic 
PASSWORD=
DOMAIN_NAME=
SERVER_NAME=
LOG_PATH=/chnesb/console51000.log
LOGIN_STR=chnesb
LOGIN_PASSWORD=

[weblogic_3]
URL=152.55.229.73:51000
USERNAME=weblogic 
PASSWORD=
DOMAIN_NAME=
SERVER_NAME=
LOG_PATH=/chnesb/console51000.log
LOGIN_STR=chnesb
LOGIN_PASSWORD=

[weblogic_4]
URL=152.55.229.74:51000
USERNAME=weblogic 
PASSWORD=
DOMAIN_NAME=
SERVER_NAME=
LOG_PATH=/chnesb/console51000.log
LOGIN_STR=chnesb
LOGIN_PASSWORD=

test.log

脚本运行日志

[2016-07-18 12:04:31]开始检查配置文件./test.cfg,./testWeblogic.config
[2016-07-18 12:04:31]开始获取全局配置信息
[2016-07-18 12:04:31]读取全局配置成功
[2016-07-18 12:04:31]开始检查weblogic...
[2016-07-18 12:04:31]获取需要检查的weblogic列表
[2016-07-18 12:04:31]读取[weblogic_1]标签weblogic的详细信息成功:
[2016-07-18 12:04:31]URL=152.55.229.71:51000,USERNAME=weblogic,PASSWORD=weblogic!123,DOMAIN_NAME=esbdomain,SERVER_NAME=EsbServer,LOG_PATH=/chnesb/console51000.log,LOGIN_STR=chnesb,LOGIN_PASSWORD=we()UJ80
[2016-07-18 12:04:31]开始检查152.55.229.71:51000 esbdomain EsbServer ...
[2016-07-18 12:04:31]远程登陆主机152.55.229.71...执行命令[ps auxwh|fgrep -v fgrep|fgrep java]
[2016-07-18 12:04:41]登陆主机152.55.229.71成功,执行命令[ps auxwh|fgrep -v fgrep|fgrep java]成功
[2016-07-18 12:04:41]当前进程PID24015消耗主机CPU的百分比为30.9%
[2016-07-18 12:04:42]远程登陆主机152.55.229.71...执行命令[fgrep -A200 <Error> /chnesb/console51000.log]
[2016-07-18 12:04:52]登陆主机152.55.229.71成功,执行命令[fgrep -A200 <Error> /chnesb/console51000.log]成功
[2016-07-18 12:04:52]已保存搜索到的weblogic日志,日志路径./weblogic.log
[2016-07-18 12:04:56]检查运行状态Run Status [OK]
[2016-07-18 12:04:56]检查健康状态Health Status [OK]
[2016-07-18 12:04:56]检查当前套接字数Open Sockets Number [OK] 当前打开数 12
[2016-07-18 12:04:56]开始检查当前weblogic的JVM使用情况
[2016-07-18 12:04:57]检查JVM使用情况完毕:
[2016-07-18 12:04:57]max_size= 2120679424,current_size= 1793261568,free_size= 1344888320,free_percent= 79
[2016-07-18 12:04:57]开始检查当前weblogic的队列使用情况
[2016-07-18 12:04:59]检查队列情况完毕:
[2016-07-18 12:04:59]free_count= 0,pending_count= 0
[2016-07-18 12:04:59]调用接口成功 响应时间 [0.014]
[2016-07-18 12:04:59]读取[weblogic_2]标签weblogic的详细信息成功:
[2016-07-18 12:04:59]URL=152.55.229.72:51000,USERNAME=weblogic,PASSWORD=weblogic!123,DOMAIN_NAME=esbdomain,SERVER_NAME=EsbServer,LOG_PATH=/chnesb/console51000.log,LOGIN_STR=chnesb,LOGIN_PASSWORD=we()UJ80
[2016-07-18 12:04:59]开始检查152.55.229.72:51000 esbdomain EsbServer ...
[2016-07-18 12:04:59]远程登陆主机152.55.229.72...执行命令[ps auxwh|fgrep -v fgrep|fgrep java]
[2016-07-18 12:05:10]登陆主机152.55.229.72成功,执行命令[ps auxwh|fgrep -v fgrep|fgrep java]成功
[2016-07-18 12:05:10]当前进程PID29757消耗主机CPU的百分比为30.6%
[2016-07-18 12:05:10]远程登陆主机152.55.229.72...执行命令[fgrep -A200 <Error> /chnesb/console51000.log]
[2016-07-18 12:05:20]登陆主机152.55.229.72成功,执行命令[fgrep -A200 <Error> /chnesb/console51000.log]成功
[2016-07-18 12:05:20]已保存搜索到的weblogic日志,日志路径./weblogic.log
[2016-07-18 12:05:24]检查运行状态Run Status [OK]
[2016-07-18 12:05:24]检查健康状态Health Status [OK]
[2016-07-18 12:05:24]检查当前套接字数Open Sockets Number [OK] 当前打开数 10
[2016-07-18 12:05:24]开始检查当前weblogic的JVM使用情况
[2016-07-18 12:05:26]检查JVM使用情况完毕:
[2016-07-18 12:05:26]max_size= 2120679424,current_size= 1793261568,free_size= 1342848232,free_percent= 78
[2016-07-18 12:05:26]开始检查当前weblogic的队列使用情况
[2016-07-18 12:05:27]检查队列情况完毕:
[2016-07-18 12:05:27]free_count= 0,pending_count= 0
[2016-07-18 12:05:27]调用接口成功 响应时间 [0.017]
[2016-07-18 12:05:27]读取[weblogic_3]标签weblogic的详细信息成功:
[2016-07-18 12:05:27]URL=152.55.229.73:51000,USERNAME=weblogic,PASSWORD=weblogic!123,DOMAIN_NAME=esbdomain,SERVER_NAME=EsbServer,LOG_PATH=/chnesb/console51000.log,LOGIN_STR=chnesb,LOGIN_PASSWORD=we()UJ80
[2016-07-18 12:05:27]开始检查152.55.229.73:51000 esbdomain EsbServer ...
[2016-07-18 12:05:27]远程登陆主机152.55.229.73...执行命令[ps auxwh|fgrep -v fgrep|fgrep java]
[2016-07-18 12:05:37]登陆主机152.55.229.73成功,执行命令[ps auxwh|fgrep -v fgrep|fgrep java]成功
[2016-07-18 12:05:37]当前进程PID3938消耗主机CPU的百分比为31.1%
[2016-07-18 12:05:37]远程登陆主机152.55.229.73...执行命令[fgrep -A200 <Error> /chnesb/console51000.log]
[2016-07-18 12:05:47]登陆主机152.55.229.73成功,执行命令[fgrep -A200 <Error> /chnesb/console51000.log]成功
[2016-07-18 12:05:47]已保存搜索到的weblogic日志,日志路径./weblogic.log
[2016-07-18 12:05:51]检查运行状态Run Status [OK]
[2016-07-18 12:05:51]检查健康状态Health Status [OK]
[2016-07-18 12:05:51]检查当前套接字数Open Sockets Number [OK] 当前打开数 10
[2016-07-18 12:05:51]开始检查当前weblogic的JVM使用情况
[2016-07-18 12:05:53]检查JVM使用情况完毕:
[2016-07-18 12:05:53]max_size= 2120679424,current_size= 1793261568,free_size= 1390624720,free_percent= 81
[2016-07-18 12:05:53]开始检查当前weblogic的队列使用情况
[2016-07-18 12:05:54]检查队列情况完毕:
[2016-07-18 12:05:54]free_count= 0,pending_count= 0
[2016-07-18 12:05:54]调用接口成功 响应时间 [0.018]
[2016-07-18 12:05:55]读取[weblogic_4]标签weblogic的详细信息成功:
[2016-07-18 12:05:55]URL=152.55.229.74:51000,USERNAME=weblogic,PASSWORD=weblogic!123,DOMAIN_NAME=esbdomain,SERVER_NAME=EsbServer,LOG_PATH=/chnesb/console51000.log,LOGIN_STR=chnesb,LOGIN_PASSWORD=we()UJ80
[2016-07-18 12:05:55]开始检查152.55.229.74:51000 esbdomain EsbServer ...
[2016-07-18 12:05:55]远程登陆主机152.55.229.74...执行命令[ps auxwh|fgrep -v fgrep|fgrep java]
[2016-07-18 12:06:05]登陆主机152.55.229.74成功,执行命令[ps auxwh|fgrep -v fgrep|fgrep java]成功
[2016-07-18 12:06:05]当前进程PID8299消耗主机CPU的百分比为38.8%
[2016-07-18 12:06:05]远程登陆主机152.55.229.74...执行命令[fgrep -A200 <Error> /chnesb/console51000.log]
[2016-07-18 12:06:15]登陆主机152.55.229.74成功,执行命令[fgrep -A200 <Error> /chnesb/console51000.log]成功
[2016-07-18 12:06:15]已保存搜索到的weblogic日志,日志路径./weblogic.log
[2016-07-18 12:06:19]检查运行状态Run Status [OK]
[2016-07-18 12:06:19]检查健康状态Health Status [OK]
[2016-07-18 12:06:19]检查当前套接字数Open Sockets Number [OK] 当前打开数 11
[2016-07-18 12:06:19]开始检查当前weblogic的JVM使用情况
[2016-07-18 12:06:21]检查JVM使用情况完毕:
[2016-07-18 12:06:21]max_size= 2120679424,current_size= 1793261568,free_size= 1451455576,free_percent= 75
[2016-07-18 12:06:21]开始检查当前weblogic的队列使用情况
[2016-07-18 12:06:23]检查队列情况完毕:
[2016-07-18 12:06:23]free_count= 0,pending_count= 0
[2016-07-18 12:06:23]调用接口成功 响应时间 [0.017]
[2016-07-18 12:06:23]临时文件已删除,脚本已退出

result.log

结果日志 供其他程序使用

[weblogic_1]
weblogic_1.url=152.55.229.71:51000
weblogic_1.java.pid=24015
weblogic_1.java.cpu=30.9
weblogic_1.errorLog=./weblogic.log
weblogic_1.AdminPermission=OK
weblogic_1.runStatus=OK
weblogic_1.healthStatus=OK
weblogic_1.openSocketsNumber= 12
weblogic_1.jvm.maxSize= 2120679424
weblogic_1.jvm.currentSize= 1793261568
weblogic_1.jvm.freeSize= 1344888320
weblogic_1.jvm.freePercent= 79
weblogic_1.queue.freeCount= 0
weblogic_1.queue.pendingCount= 0
weblogic_1.callService.status=OK
weblogic_1.callService.responseTime=0.014
[weblogic_2]
weblogic_2.url=152.55.229.72:51000
weblogic_2.java.pid=29757
weblogic_2.java.cpu=30.6
weblogic_2.errorLog=./weblogic.log
weblogic_2.AdminPermission=OK
weblogic_2.runStatus=OK
weblogic_2.healthStatus=OK
weblogic_2.openSocketsNumber= 10
weblogic_2.jvm.maxSize= 2120679424
weblogic_2.jvm.currentSize= 1793261568
weblogic_2.jvm.freeSize= 1342848232
weblogic_2.jvm.freePercent= 78
weblogic_2.queue.freeCount= 0
weblogic_2.queue.pendingCount= 0
weblogic_2.callService.status=OK
weblogic_2.callService.responseTime=0.017
[weblogic_3]
weblogic_3.url=152.55.229.73:51000
weblogic_3.java.pid=3938
weblogic_3.java.cpu=31.1
weblogic_3.errorLog=./weblogic.log
weblogic_3.AdminPermission=OK
weblogic_3.runStatus=OK
weblogic_3.healthStatus=OK
weblogic_3.openSocketsNumber= 10
weblogic_3.jvm.maxSize= 2120679424
weblogic_3.jvm.currentSize= 1793261568
weblogic_3.jvm.freeSize= 1390624720
weblogic_3.jvm.freePercent= 81
weblogic_3.queue.freeCount= 0
weblogic_3.queue.pendingCount= 0
weblogic_3.callService.status=OK
weblogic_3.callService.responseTime=0.018
[weblogic_4]
weblogic_4.url=152.55.229.74:51000
weblogic_4.java.pid=8299
weblogic_4.java.cpu=38.8
weblogic_4.errorLog=./weblogic.log
weblogic_4.AdminPermission=OK
weblogic_4.runStatus=OK
weblogic_4.healthStatus=OK
weblogic_4.openSocketsNumber= 11
weblogic_4.jvm.maxSize= 2120679424
weblogic_4.jvm.currentSize= 1793261568
weblogic_4.jvm.freeSize= 1451455576
weblogic_4.jvm.freePercent= 75
weblogic_4.queue.freeCount= 0
weblogic_4.queue.pendingCount= 0
weblogic_4.callService.status=OK
weblogic_4.callService.responseTime=0.017

weblogic.log

过滤出的指定类型的weblogic日志

正文到此结束