Twiddle

Twiddle

 

(From http://docs.jboss.org/jbossas/jboss4guide/r1/html/ch2.chapter.html )

 

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.

 

Starting in AS 6 M3, twiddle is based on JSR-160 for connecting to the AS.  The rest of this page includes both pre/post AS 6 usage.

 

Twiddle is run using either the twiddle.sh  or twiddle.bat scripts, and passing in a -h(--help) argument provides the basic syntax, and --help-commands shows what you can do with the tool (pre AS 6 M3):

 

$ ./twiddle.sh -h
A JMX client to 'twiddle' with a remote JBoss server.

usage: twiddle.sh [options] <command> [command_arguments]

options:
    -h, --help                Show this help message
        --help-commands       Show a list of commands
    -H<command>               Show command specific help
    -c=command.properties     Specify the command.properties file to use
    -D<name>[=<value>]        Set a system property
    --                        Stop processing options
    -s, --server=<url>        The JNDI URL of the remote server
    -a, --adapter=<name>      The JNDI name of the RMI adapter to use
    -u, --user=<name>         Specify the username for authentication
    -p, --password=<name>     Specify the password for authentication
    -q, --quiet               Be somewhat more quiet

 

For AS 6 M3 and later:

 

$ ./twiddle.sh -h

 

A JMX client to 'twiddle' with a remote JBoss server.

usage: twiddle.sh [options] <command> [command_arguments]

options:
    -h, --help                Show this help message
        --help-commands       Show a list of commands
    -H<command>               Show command specific help
    -c=command.properties     Specify the command.properties file to use
    -D<name>[=<value>]        Set a system property
    --                        Stop processing options
    -s, --server=<url>        The JMX service URL of the remote server (e.g. service:jmx:rmi:///jndi/rmi://localhost:1090/jmxrmi)
    -o, --host=<HOSTNAME>     The name of the remote server (e.g. localhost)
    -r, --port=<PORTNUMBER>   The rmiRegistryPort of the remote server (e.g. 1090)
    -u, --user=<name>         Specify the username for authentication
    -p, --password=<name>     Specify the password for authentication
    -q, --quiet               Be somewhat more quiet
    -v, --verbose             Be noisy

for convenience, you can specify --host and --port but not with the --server=<url> which overrides host + port.

 

Connecting twiddle to a Remote Server

 

By default (pre AS 6 M3) the twiddle command will connect to the localhost at port 1099 to lookup the default jmx/rmi/RMIAdaptor binding of the RMIAdaptor service as the connector for communicating with the JMX server. To connect to a different server/port combination you can use the -s (--server) option:

 

$ ./twiddle.sh -s toki serverinfo -d
 jboss
$ ./twiddle.sh -s toki:1099 serverinfo -d
 jboss

 

In AS 6 M3 or later, by default, the twiddle command will connect to the localhost at port 1090 (using JSR-160 support).  To connect to a different server/port combination, use the --host= and --port= options:

 

$  ./twiddle.sh --host=morpheus serverinfo -d

 

 

$ ./twiddle.sh --host=morpheus --port=1090 serverinfo -d

 

$ ./twiddle.sh -s service:jmx:rmi:///jndi/rmi://morpheus:1090/jmxrmi

 

To connect (pre AS 6 M3) using a different RMIAdaptor binding use the -a (--adapter) option:

$ ./twiddle.sh -s toki -a jmx/rmi/RMIAdaptor serverinfo -d
 jboss

 

Sample twiddle Command Usage

 

(See the documentation above)