Я пытаюсь написать простой сценарий для перезапуска сервера приложений WebSphere.
Ниже приведен мой сценарий:
ManagedProcessList=AdminControl.queryNames('WebSphere:type=Server,*')
for i in range(len(ManagedProcessList)) :
serverStatus=AdminControl.getAttribute(ManagedProcessList[i],
'state')
serverName=ManagedProcessList[i].split(',')[0].split('=')[1]
nodeName=ManagedProcessList[i].split(',')[3].split('=')[1]
if serverStatus == "STARTED":
if nodeName in ("WC_node") and serverName in ("server1"):
print
"restarting",serverName,"on",nodeName,"because it is
currently",serverStatus
AdminControl.stopServer(serverName,nodeName)
AdminControl.startServer(serverName,nodeName)
else:
print "Not restarting",serverName,"on",nodeName,"because
it is currently",serverStatus
Он возвращает приведенную ниже ошибку.
WASX7015E: Exception running command:
wsadmin>execfile('/home/raja/serverstat.py')
"execfile('/home/raja/serverstat.py')"; exception information:
com.ibm.ws.scripting.ScriptingException: WASX7025E: Error found in
String "WebSphere:W"; cannot create ObjectName.
Вывод команды выглядит следующим образом:
wsadmin>print AdminControl.queryNames('WebSphere:type=Server,*')
WebSphere:name=server1,process=server1,platform=proxy,node=WC_node,j2eeType=J2EEServer,version=7.0.0.41,type=Server,mbeanIdentifier=cells/WC_cell/nodes/WC_node/servers/server1/server.xml#Server_1183144161046,cell=WC_cell,spec=1.0,processType=UnManagedProcess
wsadmin>