April 18, 2010

Administrating JBoss MBean From the Command Line Using twiddle

In production environment you usually monitor and administrate the JBoss Application Server through ssh and command line and this is adequate when starting, stopping and reading logs, but when you want to inspect, see status and change MBean values, the command line alternative is quite limited and since the MBean architecture is central in JBoss one really wants to use the JMX-console. The JMX-console is not the most user friendly tool, but has improved with JBoss 5 and the Web Console.

But there is an alternative if you want (or must) stick with the command line alternative – twiddle. The twiddle tool is not new and has been around since JBoss 4.3. And here follows a short walk through by examples.

To print out help information use:

$ ./twiddle.sh -h


Here you see the most imported commands: info, get, invoke and setattrs.

To get attribute and operation info:

$ ./twiddle.sh info jboss:service=JNDIView


To get attribute value:

$ ./twiddle.sh get jboss:service=JNDIView StateString


To invoke an operation:

$ ./twiddle.sh invoke jboss:service=JNDIView list true

No comments: