以下 WLST 脚本可用于检查每个服务器的状态
#!/usr/bin/python
#
# Script to return the status of each of the servers
#
class StatusResult:
def __init__(self,serverName,serverStatus):
self.name = serverName
self.status = serverStatus
connect('username','password','t3://servername')
redirect('/dev/null','false')
nmStatus = 'Stopped'
if nm() == 1:
nmStatus = 'RUNNING'
statuses = [ StatusResult('NodeManager',nmStatus) ]
# Get the list of managed servers from AdminServer
for server in ['AdminServer', 'soa_server1', 'osb_server1', 'bam_server1']:
statuses.append(StatusResult(server,nmServerStatus(server)))
stopRedirect()
for result in statuses:
print result.name + ": " + result.status
disconnect()
调用脚本
. ${WL_HOME}/server/bin/setWLSEnv.sh
${MW_HOME}/oracle_common/common/bin/wlst.sh statusscript
或者,您可以使用简单的方法,例如对服务器端口进行 http 检查以查看它是否响应。这将对服务器施加最小的负载。例如,您可以使用 nagios 插件 check_http 来检查特定服务器的状态。
check_http -I serveraddr -p serverport -e 404
check_http -I serveraddr -p serversslport --ssl -e 404