简体   繁体   English

weblogic每分钟检查服务器状态

[英]weblogic check server status every minute

When I use the following command 当我使用以下命令

java weblogic.Admin -url %URL% -username %WLS_USER% -password %WLS_PW% GET -pretty -mbean "%DOMAIN_NAME%:Name=%ADMINSERVER_SERVERNAME%,Type=Server" -property ListenPort

to check the status of the server every minute, the CPU usage shoots upto 70% for just running this command and my application requires me to check the status every minute using this command, which is undesirable. 为了每分钟检查服务器的状态,只需运行此命令,CPU使用率就高达70%,我的应用程序要求我每分钟使用此命令检查状态,这是不可取的。

How to check the health of the a weblogic server instance every minute with min CPU/time using command line util so that I could invoke from script. 如何使用命令行util以最小的CPU /时间每分钟检查一次weblogic服务器实例的运行状况,以便我可以从脚本调用。

The following WLST script can be used to check the status of each of the servers 以下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()

To invoke the script 调用脚本

. ${WL_HOME}/server/bin/setWLSEnv.sh
${MW_HOME}/oracle_common/common/bin/wlst.sh statusscript

Alternatively you can use something as simple as a http check on the port of the server to see if it responds. 或者,您可以使用与服务器端口上的http检查一样简单的内容来查看它是否响应。 This will put minimal load on the server. 这将使服务器上的负载最小化。 For example you could use the nagios plugin check_http to check the status of a particular server. 例如,您可以使用nagios插件check_http来检查特定服务器的状态。

check_http -I serveraddr -p serverport -e 404
check_http -I serveraddr -p serversslport  --ssl -e 404

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM