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.
D:\jboss4.3.0.GA\bin
To access basic information about a server, use the serverinfo command.
[bin]$ ./twiddle.sh -H serverinfo
To query the server for the name of MBeans matching a pattern, use the query command.
[bin]$ ./twiddle.sh -H query
To get the attributes of an MBean, use the get command
[bin]$ ./twiddle.sh -H get
To query the MBeanInfo for an MBean, use the info command:
[bin]$ ./twiddle.sh -H info
My Test :
D:\jboss4.3.0.GA\bin>twiddle -H serverinfo
D:\jboss4.3.0.GA\bin>twiddle --server=localhost -u admin -p admin serverinfo --count
1122
D:\jboss4.3.0.GA\bin>twiddle --server=localhost -u admin -p admin serverinfo --domain
jboss
D:\jboss4.3.0.GA\bin>twiddle --server=localhost -u admin -p admin serverinfo --list
D:\jboss4.3.0.GA\bin>twiddle -s localhost -u admin -p admin get "jboss.system:type=Server" Started
Started=true
D:\jboss4.3.0.GA\bin>twiddle -s localhost -u admin -p admin invoke jboss:service=JNDIView list true
D:\jboss4.3.0.GA\bin>twiddle -s localhost -u admin -p admin get "jboss.system:type=ServerInfo" MaxMemory
MaxMemory=799145984
D:\jboss4.3.0.GA\bin>twiddle -s localhost -u admin -p admin query "jboss.system:type=ServerInfo"
jboss.system:type=ServerInfo
D:\jboss4.3.0.GA\bin>twiddle -s localhost -u admin -p admin query "jboss.system:*"
jboss.system:service=MainDeployer
jboss.system:type=Log4jService,service=Logging
jboss.system:service=ServiceDeployer
jboss.system:service=ThreadPool
jboss.system:service=JARDeployer
jboss.system:type=Server
jboss.system:service=ServiceController
jboss.system:type=ServerConfig
jboss.system:type=ServerInfo
see:
D:\jboss4.3.0.GA\server\mycis\deploy\snmp-adaptor.sar\attributes.xml
<mbean name="jboss.system:type=ServerInfo" oid-prefix=".1.2.3.4.1">
<attribute name="ActiveThreadCount" oid=".1"/>
<attribute name="FreeMemory" oid=".2"/>
<attribute name="MaxMemory" oid=".3"/>
</mbean>