[Linux]WAS(Oracle Weblogic)의 instance 상태 확인
출근하면 매일 아침 첫 번째로 하는 일이 서버의 상태를 점검하는 것인데, Linux 서버의 상태를 점검하면서 함께 WAS(Oracle Weblogic) Instance의 상태를 확인하고 있습니다. 웹 콘솔에서도 확인할 수 있으나 웹 사이트 로그인하기가 귀찮네요.
Cluster로 구성된 경우에는 서버 중에 하나에 문제가 발생해도 정상적으로 서비스를 제공할 수 있습니다. 그래서 습관처럼 매일 점검해야 합니다. Daily Health Check 스크립트에 “status.sh” 파일의 실행을 추가하면 서버 상태와 함께 WAS 서버 운영 상태도 함께 점검할 수 있습니다.
Weblogic 서버 점검 절차
## weblogic 설치 시 생성한 domain 디렉토리로 이동 ##
cd /usr/local/weblogic/12.1.3/domains/your_domain
## 상태 점검을 위한 Script 파일 작성 ##
vi status.py
#WAS 설정 사항에 맞게 아래 connect 정보를 입력
#format : connect([username],[password],[admin url])
connect('weblogic_user','weblogic_passwd','t3://your_ip_address:port')
servers=cmo.getServers()
print "-------------------------------------------------------"
print "\t"+cmo.getName()+" domain status"
print "-------------------------------------------------------"
for server in servers:
state(server.getName(),server.getType())
print "-------------------------------------------------------"
## 상태 점검 Script를 실행하기 위한 실행 파일 작성 ##
vi status.sh
/usr/local/weblogic/12.1.3/oracle_common/common/bin/wlst.sh /usr/local/weblogic/12.1.3/domains/your_domain/status.py 2>&1
## 상태 점검 실행 파일 실행 결과 ##
## ITOJ, ITOK라는 서버를 운영하고 있습니다. ##
./status.sh
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to t3://your_ip_address:port with userid weblogic ...
Successfully connected to Admin Server "AdminServer" that belongs to domain "your_domain".
Warning: An insecure protocol was used to connect to the
server. To ensure on-the-wire security, the SSL port or
Admin port should be used instead.
-------------------------------------------------------
scpuser_domain domain status
-------------------------------------------------------
Current state of "AdminServer" : RUNNING
Current state of "ITOJ" : RUNNING
Current state of "ITOK" : RUNNING
-------------------------------------------------------
Webtier(OHS) instance 점검 절차
## webtier(OHS) 설치 시 생성한 domain 디렉토리로 이동 ##
cd /usr/local/weblogic/12.1.3/domains/your_domain
## 상태 점검을 위한 Script 파일 작성 ##
## admin_passwd, port#, your_domain은 site에 맞게 수정 ##
vi status.py
try:
componentName = java.lang.System.getenv('componentName')
nmConnect('admin','admin_passwd', 'localhost', 'port#','your_domain')
nmServerStatus('scpuser',serverType='OHS')
exit()
except Exception,e:
print 'Error:', sys.exc_info()[1]
exit(exitcode=1)
## 상태 점검 Script을 실행하기 위한 실행 파일 작성 ##
vi status.sh
/usr/local/webtier/12.2.1.4/oracle_common/common/bin/wlst.sh -i /usr/local/webtier/12.2.1.4/domains/your_domain/status.py 2>&1
## 상태 점검 실행 파일 실행 결과 ##
./status.sh
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Connecting to Node Manager ...
Successfully Connected to Node Manager.
RUNNING