Thursday, January 28, 2016

Add/Delete Custom Property under Administration

Add:

import re
print "Listing All Servers"
appServer=AdminConfig.list('Server')
Administration=AdminConfig.list("ApplicationServer", appServer)
print "Adding Property com.ibm.websphere.threadmonitor.threshold"
AdminConfig.create('Property', Administration, '[[name "com.ibm.websphere.threadmonitor.threshold"] [description "com.ibm.websphere.threadmonitor.threshold"] [value 1800]]')
print "Property added com.ibm.websphere.threadmonitor.threshold, Now Saving the configuration"
AdminConfig.save()
print "Saved the configuration"
AdminConfig.list('Property',Administration)
print "List all Administration Properties"





Delete:
import re
print "Listing All Servers"
appServer=AdminConfig.list('Server')
Administration=AdminConfig.list("ApplicationServer", appServer)
all_property=AdminConfig.list('Property',Administration).splitlines()
for property in all_property:
 if property.find("com.ibm.websphere.threadmonitor.threshold")==-1:
  status=1
 else:
  print "Removing Property com.ibm.websphere.threadmonitor.threshold"
  AdminConfig.remove(property)
  print "Property com.ibm.websphere.threadmonitor.threshold removed, Now Saving the configuration"
  AdminConfig.save()
  print "Saved the configuration"


No comments:

Post a Comment