« JProfiler 3.0 still a star | Main | Working on bladecenters. »

April 12, 2004

5.x JMX, Jython simple script to set trace at the cluster level.

I don't know about you, but I generally get tired pretty quick of turning trace on and off for a cluster. I'll show how to write a script to make this easier.

This script shows how to enable trace for all members of a cluster either just transiently on the current running servers or persistently for the next time the cluster restarts. I use jython mainly because I can't read jacl at all, I find jython much easier to write.
The script talks to the deployment manager so it must be running for this script to operate.

Here is the jython script to execute:
Clustertrace jython

Here is a windows script to make using it easier:
Clustertrace windows script

To use it, ensure the DM is running and run the script on the DM machine. You may need to tweak the cmd file to specify the host for the DM. For now, you need to run the script on the dm node. Just specify the command line args to wsadmin to connect to the right server otherwise.

clustertrace (perm|temp) traceString [--c clustername | --s servername]

perm means makes the changes permanently. They won't take effect until the impacted server(s) are restarted. temp means make the change right now on the running server(s) but if they are restarted then they revert to the permanent trace setting which can be changed with the perm option.

The c option allows a cluster name to be specified and all cluster members will receive the trace string. If you're using temp then only the running cluster members receive the string.

The s option allows a specific server to be set rather than a whole cluster. So, to turn on trace for a cluster use:

clustertrace perm com.ibm.ws.*=all=enabled --c billyCluster

To turn off trace use:

clustertrace perm com.ibm.ws.*=all=disabled --c billyCluster

Change perm to temp to have the change take effect immediately on any running cluster members.

April 12, 2004 in WebSphere JMX | Permalink


I'm having a hard time extrapolating how to tell if a cluster is running so I can stop it prior to uninstalling and re-installing a EAR. Do you have anymore Jython examples that might help me?

Posted by: Curtis Yanko | Sep 9, 2005 1:36:15 PM

Post a comment