Вопрос

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.

Это было полезно?

Решение

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.

Другие советы

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top