How to get current application state from wsadmin console for WebSphere 7.0

南笙酒味 提交于 2019-11-30 20:25:10

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/9910511/how-to-get-current-application-state-from-wsadmin-console-for-websphere-7-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!