• 1 reply
  • Latest Post - ‏2011-06-22T17:45:16Z by SystemAdmin
2 Posts

Pinned topic wsadmin jython scripting (set monitoring policy)

‏2011-06-22T16:30:35Z |
Looks like a library problem similar to those which have aplready been reported... however, I am new to Jython, having done all my previous work in JACL. Nonetheless, I am ready to bite the bullet and tackle a new learning curve.

Please let me know if this is truly a syntax error. Thanks!



C:\IBM\WebSphere\AppServer\profiles\Dmgr01\bin>wsadmin -user admin -password password -lang jython -javaoption "-Djy
thon.package.path=C:/IBM/WebSphere/AppServer/plugins/" -f
sys-package-mgr: processing new jar, 'C:\IBM\WebSphere\AppServer\plugins\'
WASX7209I: Connected to process "dmgr" on node 6475HM9R8FDKCMCellManager01 using SOAP connector; The type of proces
s is: DeploymentManager
WASX7017E: Exception received while running file ""; exception information:
f.BSFException: exception from Jython:
Traceback (innermost last):
(no code object) at line 0
File "<string>", line 2
outlist = []
SyntaxError: invalid syntax



def convertToList( inlist ):
outlist = []
if (len(inlist) > 0):
if (inlist[0] == '[' and inlist'):
  1. Special checking when the config name contain space
if (inlist[1] == "\"" and inlistlen(inlist)-2 == "\""):
clist = inlist1:len(inlist) -1.split(")\" ")
clist = inlist1:len(inlist) - 1.split(" ")
clist = inlist.split(java.lang.System.getProperty("line.separator"))

for elem in clist:
elem = elem.rstrip();
if (len(elem) > 0):
if (elem[0] == "\"" and elemlen(elem) -1 != "\""):
elem = elem+")\""
return outlist

nodeRestartState_attr =
attr_list = nodeRestartState_attr
  1. List servers with specified server type
servers = AdminTask.listServers('-serverType APPLICATION_SERVER ')
print servers
  1. Convert Jython string to list
servers = AdminUtilities.convertToList(servers)
print servers

  1. Loop through each server in server list
for aServer in servers:
  1. Obtain server and node names
sname = aServer
print "Server name="sname"\n"
print sname
nname = aServer
print "Node name="nname"\n"
monitoringPolicy = AdminConfig.list("MonitoringPolicy", server )
AdminConfig.modify(monitoringPolicy, attr_list ) )

Updated on 2011-06-22T17:45:16Z at 2011-06-22T17:45:16Z by SystemAdmin
  • SystemAdmin
    462 Posts

    Re: wsadmin jython scripting (set monitoring policy)

    Your Jython source code does not have indentation. Not sure the indentation was lost during pasting. Jython does not use curly braces so code block must be properly indented.