1

folks,

How I can get current status for application deployed on websphere (such as started/stopped)? I know, that I can use AdminControl.completeObjectName('type=Application,name=myApplication,*') but if I just invoked start it is very much likely that following command will return nothing since app is not in running state yet. Same way, when I just invoked stop I want to display that app is actually stopped so that I won't change anything while app is still running. Any ideas how I can do this? Thanks.

RomanB
  • 53
  • 1
  • 6
  • Isn't this a duplicate question? http://stackoverflow.com/questions/8185866/how-do-i-determine-if-an-application-is-running-using-wsadmin-jython-script – Manglu Mar 28 '12 at 22:43
  • Nope, it is not the same. I need immediate status. With that solution I can't get status "partially running". – RomanB Apr 09 '12 at 17:54

2 Answers2

0

You can try to do this. It's a bit of work, but it's possible.

  1. Use application name to get the deployment target. Since you mentioned multiple nodes, I'm guessing the deployment target is going to be a cluster.
  2. Use the cluster to find the members of the cluster, which would be servers.
  3. Use the server names to check the status of each individual server.

If all servers of that cluster are started, then the application is started. If all servers of that cluster are stopped, then the application is stopped. If some are started and some are stopped, then the application is partially started.

Hope that helps.

MD6380
  • 1,007
  • 4
  • 13
  • 26
0

as for me I get application status in websphere 6.1 this way:

#--------------------------------------------------------------
# get app object name
#--------------------------------------------------------------

appObjectNames = AdminControl.queryNames('type=Application,cell=' + cellName + 
    ',node=' + nodeName + ',process=' + serverName + ',name=' + appName + ',*')

lineSeparator = java.lang.System.getProperty('line.separator')
appObjectName = appObjectNames.split(lineSeparator)[0]
appObjectName = appObjectName.strip()

#--------------------------------------------------------------
# get application status
#--------------------------------------------------------------

if len(appObjectName) == 0:
    tprint(prefix + 'application ' + appName + ' is stopped')
else:        
    tprint(prefix + 'application ' + appName + ' is started')

I guess this should work in WebSphere 7.0 as well.

temp_
  • 36
  • 3
  • Its not going to work on cluster environment (where you have multiple nodes). When I deployed to dmanager, and called "startApplicationOnCluster" it takes sometime for app to start on all node. I need to ensure that app is running on all nodes. – RomanB Apr 09 '12 at 18:00