Note the wildcard feature when listing AdminConfig types (Line 24), very handy.
#================================================================= # Setup #================================================================= import sys clusterName = sys.argv[0] min = sys.argv[1] max = sys.argv[2] #================================================================= # Subs #================================================================= def getJvms(clusterName): # Get the cluster ID cluster = AdminConfig.list('ServerCluster', '*'+clusterName+'*') # Get a list of the clusters members members = AdminConfig.showAttribute(cluster, 'members') memberArray = members.split('[')[1].split(']')[0].split(' ') # Detemine JVM's jvms = [] for member in memberArray: memberName = AdminConfig.showAttribute(member, 'memberName') jvms.append(AdminConfig.list('JavaVirtualMachine', '*'+memberName+'*')) return jvms def setHeap(jvms, min, max): for jvm in jvms: print 'Setting '+jvm+' heap sizes of '+str(min)+' and '+str(max) AdminConfig.modify(jvm, [['initialHeapSize', min]]) AdminConfig.modify(jvm, [['maximumHeapSize', max]]) #================================================================= # Main #================================================================= jvms = getJvms(clusterName) setHeap(jvms, min, max) AdminConfig.save()
No comments:
Post a Comment