Dear All,
Recently I was searching about some monitoring on JBOSS. I have come to know about command for monitoring using twiddle.sh(a script that already come with jboss, you can find it in $JBOSS_HOME/bin directory).
So below are some commands:
1.) cd /data2/jbosscdot/bin/
2.) ./twiddle.sh --help-command
twiddle.sh commands:
jsr77 Print out JSR77 related information
xmbean Print out mbean metadata as an xmbean descriptor
info Get the metadata for an MBean
get Get the values of one or more MBean attributes
invoke Invoke an operation on an MBean
create Create an MBean
setattrs Set the values of one or more MBean attributes
unregister Unregister one or more MBeans
queryMethod Query the server for a list of matching methods of MBeans
listDomains Query the server for a list of available domains
query Query the server for a list of matching MBeans
set Set the value of one MBean attribute
serverinfo Get information about the MBean server
protocol :- jnp ( This is optional)
serverName :- Since we will be executing the command from the box where JBoss is installed, we can either give “localhost” or actual server name.
port :- 1099.
This the port where Jboss Naming service is listening. If you are using out of box Jboss installation then this will be the port. But if you changed this and you don’t remember the port, then either check the file “JBOSS_HOME/server/<serverName>/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml” or log on to “http://<serverName>:<port>/jmx-console” and click on “jboss” on left column and then click “service=Naming” and the value for the attribute “port”.
jsr77 :- displays jsr77 related information.
xmbean :- print out mbean metadata as an “xmbean” descriptor. In this file you can find all attributes and operations on a particular mbean.
info :- get the metdata for an MBean.
get :- get value for an mbean attribute.
invoke :- invoke an operation on an MBean
create :- create an MBean
setattrs :- set the values of one or more MBean attributes
unregister :- unregister one or more MBeans
queryMethod :- query list of matchin methods on MBeans
listDomains :- list all the domains.
query :- query list of matching MBeans
set :- set the value for one MBean attribute
serverinfo :- get the information about MBean Server.
Examples :-
jsr77 :-
Displays the “jsr77” information for this particular server.
./twiddle.sh -s jnp://localhost:1099 -u admin -p admin jsr77
xmbean :-
Displays information of the MBean as “xmbean” descriptor.
./twiddle.sh -s jnp://localhost:1099 -u admin -p admin xmbean jboss:service=Naming
info :-
Query attribute of a particular bean.
./twiddle.sh -s jnp://localhost:1099 -u admin -p admin xmbean jboss:service=Naming
get :-
Get value of a particular ‘attribute’.
./twiddle.sh -s localhost:1099 -u admin -p admin get 'jboss:service=Naming' Name
Get value of a multiple ‘attributes’. The attributes must be separated by ‘Space’.
./twiddle.sh -s localhost:1099 -u admin -p admin get 'jboss:service=Naming' Name State
invoke :-
Invoke operation on a particular mbean.
./twiddle.sh -s localhost:1099 -u admin -p admin invoke jboss.system:type=ServerInfo listThreadCpuUtilization
Note :- There are multiple additional options, I didn’t explore them as of now.
create :-
Create an MBean.
I didn’t explore this command, I need to do research on this command a little more. I will update this article once I found more on this command.
setattrs :-
Set values of one or more bean attributes.
In below command we set values of two attributes “BackLog” and “JNPServerSocketFactoryBean” to “100” and “null” respectively.
./twiddle.sh -s localhost:1099 -u admin -p admin setattrs 'jboss:service=Naming' Backlog 100 JNPServerSocketFactory null
unregister :-
Unregister a one or more Mbeans.
Again I didn’t get much chance to explore this command, will update on this on this command once I am done with research.
queryMethod :-
Query all methods on all Mbeans.
./twiddle.sh -s localhost:1099 -u admin -p admin queryMethod list
Query methods on few mbeans
./twiddle.sh -s localhost:1099 -u admin -p admin queryMethod -f 'jboss:*' list
listDomains :-
List all the domains.
./twiddle.sh -s localhost:1099 -u admin -p admin listDomains
query :-
Display all Mbeans on the server.
./twiddle.sh -s localhost:1099 -u admin -p admin query '*:*'
Display MBeans on particular domain. In below command we display in the domain “jboss:j2ee”.
./twiddle.sh -s localhost:1099 -u admin -p admin query 'jboss.j2ee:*'
set :-
Set the value on particular attribute.
./twiddle.sh -s localhost:1099 -u admin -p admin set 'jboss.system:service=Logging,type=Log4jService' RefreshPeriod 60
Examples :
[root@server199 bin]# ./twiddle.sh -s 192.168.2.199:1099 -u admin -p admin get 'jboss.system:type=ServerInfo'
ActiveThreadCount=92
AvailableProcessors=2
OSArch=i386
MaxMemory=1168179200
HostAddress=192.168.2.199
JavaVersion=1.6.0_24
OSVersion=2.6.18-164.11.1.el5_lustre.1.8.2
JavaVendor=Sun Microsystems Inc.
TotalMemory=1168179200
ActiveThreadGroupCount=9
OSName=Linux
FreeMemory=193302168
HostName=server199
JavaVMVersion=19.1-b02
JavaVMVendor=Sun Microsystems Inc.
JavaVMName=Java HotSpot(TM) Server VM
Some more info about "serverinfo" command:
serverinfo :-
Display information about MBean server.
./twiddle.sh -s IP:1099 -u admin -p admin serverinfo -l
Number of MBeans on the server.
./twiddle.sh -s IP:1099 -u admin -p admin serverinfo -c
Default Domain.
./twiddle.sh -s IP:1099 -u admin -p admin serverinfo -d
e.g. :
============================================
[root@server199 bin]# ./twiddle.sh -s 192.168.2.199:1099 -u admin -p admin serverinfo -l | grep -i "jboss.system:type"
jboss.system:type=Server
jboss.system:type=Log4jService,service=Logging
jboss.system:type=ServerInfo
jboss.system:type=ServerConfig
============================================
[root@server199 bin]# ./twiddle.sh -s 192.168.2.199:1099 -u admin -p admin get 'jboss.system:type=ServerConfig'
ServerDataDir=/data2/jbosscdot/server/default/data
ExitOnShutdown=true
ServerLogDir=/data2/jbosscdot/server/default/log
CommonLibraryURL=file:/data2/jbosscdot/common/lib/
ServerConfigURL=file:/data2/jbosscdot/server/default/conf/
HomeURL=file:/data2/jbosscdot/
ServerTempDeployDir=/data2/jbosscdot/server/default/tmp/deploy
RequireJBossURLStreamHandlerFactory=true
PlatformMBeanServer=false
ServerNativeDir=/data2/jbosscdot/server/default/tmp/native
ServerTempDir=/data2/jbosscdot/server/default/tmp
ServerHomeURL=file:/data2/jbosscdot/server/default/
ServerName=default
RootDeploymentFilename=jboss-service.xml
PatchURL=null
BlockingShutdown=false
SpecificationVersion=5.1.0.GA
ServerHomeDir=/data2/jbosscdot/server/default
ServerLibraryURL=file:/data2/jbosscdot/server/default/lib/
CommonBaseURL=file:/data2/jbosscdot/common/
ServerBaseDir=/data2/jbosscdot/server
LibraryURL=file:/data2/jbosscdot/lib/
ServerBaseURL=file:/data2/jbosscdot/server/
HomeDir=/data2/jbosscdot
[root@server199 bin]#
!Enjoy
Kuldeep Sharma
Recently I was searching about some monitoring on JBOSS. I have come to know about command for monitoring using twiddle.sh(a script that already come with jboss, you can find it in $JBOSS_HOME/bin directory).
So below are some commands:
1.) cd /data2/jbosscdot/bin/
2.) ./twiddle.sh --help-command
twiddle.sh commands:
jsr77 Print out JSR77 related information
xmbean Print out mbean metadata as an xmbean descriptor
info Get the metadata for an MBean
get Get the values of one or more MBean attributes
invoke Invoke an operation on an MBean
create Create an MBean
setattrs Set the values of one or more MBean attributes
unregister Unregister one or more MBeans
queryMethod Query the server for a list of matching methods of MBeans
listDomains Query the server for a list of available domains
query Query the server for a list of matching MBeans
set Set the value of one MBean attribute
serverinfo Get information about the MBean server
Syntax :-
./twiddle.sh -s <serverUrl> -u <userName> -p <password> <command> [ command_arguments
serverUrl :- <protocol>://<serverName>:<port>protocol :- jnp ( This is optional)
serverName :- Since we will be executing the command from the box where JBoss is installed, we can either give “localhost” or actual server name.
port :- 1099.
This the port where Jboss Naming service is listening. If you are using out of box Jboss installation then this will be the port. But if you changed this and you don’t remember the port, then either check the file “JBOSS_HOME/server/<serverName>/conf/bindingservice.beans/META-INF/bindings-jboss-beans.xml” or log on to “http://<serverName>:<port>/jmx-console” and click on “jboss” on left column and then click “service=Naming” and the value for the attribute “port”.
Commands :-
xmbean :- print out mbean metadata as an “xmbean” descriptor. In this file you can find all attributes and operations on a particular mbean.
info :- get the metdata for an MBean.
get :- get value for an mbean attribute.
invoke :- invoke an operation on an MBean
create :- create an MBean
setattrs :- set the values of one or more MBean attributes
unregister :- unregister one or more MBeans
queryMethod :- query list of matchin methods on MBeans
listDomains :- list all the domains.
query :- query list of matching MBeans
set :- set the value for one MBean attribute
serverinfo :- get the information about MBean Server.
Examples :-
jsr77 :-
Displays the “jsr77” information for this particular server.
./twiddle.sh -s jnp://localhost:1099 -u admin -p admin jsr77
xmbean :-
Displays information of the MBean as “xmbean” descriptor.
./twiddle.sh -s jnp://localhost:1099 -u admin -p admin xmbean jboss:service=Naming
info :-
Query attribute of a particular bean.
./twiddle.sh -s jnp://localhost:1099 -u admin -p admin xmbean jboss:service=Naming
get :-
Get value of a particular ‘attribute’.
./twiddle.sh -s localhost:1099 -u admin -p admin get 'jboss:service=Naming' Name
Get value of a multiple ‘attributes’. The attributes must be separated by ‘Space’.
./twiddle.sh -s localhost:1099 -u admin -p admin get 'jboss:service=Naming' Name State
invoke :-
Invoke operation on a particular mbean.
./twiddle.sh -s localhost:1099 -u admin -p admin invoke jboss.system:type=ServerInfo listThreadCpuUtilization
Note :- There are multiple additional options, I didn’t explore them as of now.
create :-
Create an MBean.
I didn’t explore this command, I need to do research on this command a little more. I will update this article once I found more on this command.
setattrs :-
Set values of one or more bean attributes.
In below command we set values of two attributes “BackLog” and “JNPServerSocketFactoryBean” to “100” and “null” respectively.
./twiddle.sh -s localhost:1099 -u admin -p admin setattrs 'jboss:service=Naming' Backlog 100 JNPServerSocketFactory null
unregister :-
Unregister a one or more Mbeans.
Again I didn’t get much chance to explore this command, will update on this on this command once I am done with research.
queryMethod :-
Query all methods on all Mbeans.
./twiddle.sh -s localhost:1099 -u admin -p admin queryMethod list
Query methods on few mbeans
./twiddle.sh -s localhost:1099 -u admin -p admin queryMethod -f 'jboss:*' list
listDomains :-
List all the domains.
./twiddle.sh -s localhost:1099 -u admin -p admin listDomains
query :-
Display all Mbeans on the server.
./twiddle.sh -s localhost:1099 -u admin -p admin query '*:*'
Display MBeans on particular domain. In below command we display in the domain “jboss:j2ee”.
./twiddle.sh -s localhost:1099 -u admin -p admin query 'jboss.j2ee:*'
set :-
Set the value on particular attribute.
./twiddle.sh -s localhost:1099 -u admin -p admin set 'jboss.system:service=Logging,type=Log4jService' RefreshPeriod 60
Examples :
[root@server199 bin]# ./twiddle.sh -s 192.168.2.199:1099 -u admin -p admin get 'jboss.system:type=ServerInfo'
ActiveThreadCount=92
AvailableProcessors=2
OSArch=i386
MaxMemory=1168179200
HostAddress=192.168.2.199
JavaVersion=1.6.0_24
OSVersion=2.6.18-164.11.1.el5_lustre.1.8.2
JavaVendor=Sun Microsystems Inc.
TotalMemory=1168179200
ActiveThreadGroupCount=9
OSName=Linux
FreeMemory=193302168
HostName=server199
JavaVMVersion=19.1-b02
JavaVMVendor=Sun Microsystems Inc.
JavaVMName=Java HotSpot(TM) Server VM
Some more info about "serverinfo" command:
serverinfo :-
Display information about MBean server.
./twiddle.sh -s IP:1099 -u admin -p admin serverinfo -l
Number of MBeans on the server.
./twiddle.sh -s IP:1099 -u admin -p admin serverinfo -c
Default Domain.
./twiddle.sh -s IP:1099 -u admin -p admin serverinfo -d
e.g. :
============================================
[root@server199 bin]# ./twiddle.sh -s 192.168.2.199:1099 -u admin -p admin serverinfo -l | grep -i "jboss.system:type"
jboss.system:type=Server
jboss.system:type=Log4jService,service=Logging
jboss.system:type=ServerInfo
jboss.system:type=ServerConfig
============================================
[root@server199 bin]# ./twiddle.sh -s 192.168.2.199:1099 -u admin -p admin get 'jboss.system:type=ServerConfig'
ServerDataDir=/data2/jbosscdot/server/default/data
ExitOnShutdown=true
ServerLogDir=/data2/jbosscdot/server/default/log
CommonLibraryURL=file:/data2/jbosscdot/common/lib/
ServerConfigURL=file:/data2/jbosscdot/server/default/conf/
HomeURL=file:/data2/jbosscdot/
ServerTempDeployDir=/data2/jbosscdot/server/default/tmp/deploy
RequireJBossURLStreamHandlerFactory=true
PlatformMBeanServer=false
ServerNativeDir=/data2/jbosscdot/server/default/tmp/native
ServerTempDir=/data2/jbosscdot/server/default/tmp
ServerHomeURL=file:/data2/jbosscdot/server/default/
ServerName=default
RootDeploymentFilename=jboss-service.xml
PatchURL=null
BlockingShutdown=false
SpecificationVersion=5.1.0.GA
ServerHomeDir=/data2/jbosscdot/server/default
ServerLibraryURL=file:/data2/jbosscdot/server/default/lib/
CommonBaseURL=file:/data2/jbosscdot/common/
ServerBaseDir=/data2/jbosscdot/server
LibraryURL=file:/data2/jbosscdot/lib/
ServerBaseURL=file:/data2/jbosscdot/server/
HomeDir=/data2/jbosscdot
[root@server199 bin]#
!Enjoy
Kuldeep Sharma