siva
siva

Reputation: 1145

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.

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.

Upvotes: 1

Views: 12189

Answers (1)

sweetfa
sweetfa

Reputation: 5845

The following WLST script can be used to check the status of each of the servers

#!/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. 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.

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

Upvotes: 4

Related Questions