Architecture/WAS

Websphere(Incl. IHS) 점검 script

GOMSHIKI 2023. 11. 16. 09:01
반응형
#!/bin/sh

PRO_NAME="websphere"

set -A WAS_LIST1 \
Container명1 \
Container명2 \
Container명3 \
Container명4 \
Container명5

set -A WAS_LIST2 \
"Maganer" \
"Container명1 WAS" \
"Container명2 WAS" \
"Container명3 WAS" \
"Container명4 WAS"

echo
echo "------------ WAS Process Check Start ------------"

i=0

for n in ${WAS_LIST1[@]}
do

PS_CNT= `ps -ef | awk '{ AA ="whoami"; AA | getline BB; close(AA); if($1 == BB) print}' | grep ${PRO_NAME} | grep "${n}$" | wc -l | tr -d " "`

if [ ${PS_CNT} -eq 1 ]
then 
	print "%-22s%3s%s\n" "${WAS_LIST2[$i]}  " " : " "[     OK ]"
else
	echo  "\033[5m\c"
    printf "%-22s%3s%s\n" "${WAS_LIST2[$i]}  " " : " "[ NOT OK ]"
    echo "\033[0m\c"
fi

i=$((${i}+1))

done

echo "----------- WAS Process Check END -----------"
echo


echo "----------- Container Check Start -----------"

i = 0

for n in ${WAS_LIST1[@]}
do

if [ `/APP/websphere/AppServer/bin/serverStatus.sh ${n} | grep STARTED | wc -l` -eq 1 ]
then 
	printf "%-22s%3%10s\n" "${WAS_LIST2[$i]}  " " : " " [     OK ]"
else
	echo "\033[5m\c"
    printf "%-22s%3s%10s\n" "${WAS_LIST2[$i]} " " : " " [  NOT OK  ]"
    echo "\033[0m\c"
    echo "Type for check : /APP/websphere/AppServer/bin/serverStatus.sh ${n}"
fi

i=$((${i}+1))

done

echo "------------ Container Check End -------------"
echo



###### WEB Server status Check Start ########
echo "------------WEB Service Check Start --------------"

if [ `/APP/websphere/AppServer/bin/serverStatus.sh webserver1 | grep RUNNING | wc -l` -eq 1 ]
then
	printf "%-22s%3s%10s\n" "webserver1" " : " "[     OK ]"
else
	echo "\033[5m\c"
    printf "%-22s%3%10s\n" "webserver1" " : " "[ NOT OK ]"
    echo "\033[0m\c"
    echo "Type for check : /APP/websphere/AppServer/bin/serverStatus.sh webserver1"
fi

echo "------------ WEB Service Check End -----------"
echo
반응형