Enable verbose garbage collection on all servers in cluster using jacl
Today I needed to enable verbose garbage collections on all production servers to troubleshoot a potential memory leak.
As we have 30 application servers in our clusters and using the web interface would require multiple clicks and page load times, I created a little script to do this.
This can of course be altered to change other parameters, and ideally being put in a function so it can be called using the clustername and cellname as parameters.
# Enable Verbose Garbage collection for all servers in cluster
#
# Author: Wannes Rams
# Mail: wannes@ramsit.com
#
# Version: 1.0
# Date: 2015-08-11
#
# License: Apache 2.0
#
# set variables
set cellName SocialCell
set nodeName ConnectionsNode01
# get server config
set clusters [$AdminConfig list ServerCluster]
foreach cluster $clusters {
set memberlist [$AdminConfig showAttribute $cluster members]
set members [lindex $memberlist 0]
foreach member $members {
set serverName [$AdminConfig showAttribute $member memberName]
set server [$AdminConfig getid /Server:$serverName/]
#set server [$AdminConfig getid /Cell:$cellName/Node:$nodeName/Server:$serverName/]
puts "$server"
set jvm [$AdminConfig list JavaVirtualMachine $server]
$AdminConfig modify $jvm {{verboseModeGarbageCollection true}}
puts "GarbageCollection Enabled: [$AdminConfig showAttribute $jvm verboseModeGarbageCollection]"
$AdminConfig save
}
}";}}