The below post describes some common usage scenarios of the twiddle JBoss command line utility.
JBoss provides a simple command line tool that allows for interaction with a remote JMX server instance. This tool is called twiddle (for twiddling bits via JMX) and is located in the bin directory of the distribution. Twiddle is a command execution tool, not a general command shell.
Twiddle utility is located in $JBOSS_HOME/bin directory.
You can refer a good read on Twiddle basics from the below link.
http://weblogic-wonders.com/weblogic/2010/12/22/jboss-command-line-utility-twiddle/
Twiddle commands to read the information.
Getting Server Information:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin get “jboss.system:type=ServerInfo”
Getting Global JNDI Information:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin get “jboss:service=JNDIView”
Getitng Jboss Logging Information
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin get “jboss.system:type=Log4jService,service=Logging”
Getting Thread Pool information:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin get “jboss.system:service=ThreadPool”
Twiddle commands to execute operations.
Deploying an application:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss.system:service=MainDeployer” deploy “file:\D:\TestApp.war”
Re-Deploying an application:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss.system:service=MainDeployer” redeploy “file:\D:\TestApp.war”
Un-Deploying an application:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss.system:service=MainDeployer” undeploy “file:\D:\TestApp.war”
Capturing Thread Dumps:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss.system:type=ServerInfo” listThreadDump
List the thread CPU utilization
G:\jboss-eap-5.1\jboss-as\bin>twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss.system:type=ServerInfo” listThreadCpuUtilization>> c:\out.html
Listing the memory pools:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss.system:type=ServerInfo” listMemoryPools true
Changing logging levels to Debug
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss.system:type=Log4jService,service=Logging” setLoggerLevel org.apache debug
Stopping a DataSource:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss:service=Hypersonic,database=localDB” stop
Starting a DataSource:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss:service=Hypersonic,database=localDB” start
Stopping the server:
twiddle.bat -s jnp://localhost:1099 –user=admin –password=admin invoke “jboss.system:type=Server” shutdown
Some of the other JMX services that can be used as below.
• jboss:type=Service,name=SystemProperties – enables you to view the system properties
• jboss:service=JNDIView – enables you to view the contents of JNDI
• jboss.system:type=Log4jService,service=Logging – enable you to change log levels
• jboss.system:service=ThreadPool – enables you to change the thread pool
• jboss.system:type=Server – provides information about the server
• jboss.system:type=ServerConfig – provides information about the server
• jboss.system:type=ServerInfo – provides information about the server
References:
Cheers,
Wonders Team
One Trackback/Pingback
[...] Twiddle While JMX-Console provides UI way of debugging and changing the settings, the same can be achieved through command line by another utility named twiddle that comes bundled with Jboss and is located in the bin folder of the same. It can perform every task that a JMX-Console can do through UI. I found a nice article depicting the usage of Twiddle with examples. Have a look at, http://weblogic-wonders.com/weblogic/2011/02/13/twiddle-utility-examples/ [...]
Post a Comment