Friday, December 9, 2011

JMX command line

JConsole is a nice tool to connect jmx service and invoke methods. But It need a XServer, since it is a GUI. But I found a nice command line tools to call mbeans easily. It's name is jmxterm. Google it and downlaod it. it is a jar file and console and it can be started with 'java -jar XXX.jar'.

In the terminal you can type
1 ) #> open service:jmx:rmi://127.0.0.1/jndi/rmi://127.0.0.1:1099/smsc-management
It will open the jmx connection to specified url.

2) #> beans
#domain = smsc:
smsc:name=smsc_configurations,type=smsc

It will display the available beans names

3) #> bean smsc:name=smsc_configurations,type=smsc
It will set the current bean

4) #> info
# operations
%0 - void reloadRules()
It will display available operations.

5) #> run reloadRules
It will run the method specified

Reference : http://sandarenu.blogspot.com/2009/08/command-line-client-for-jmx.html

Oki. Happy Coding !!!

Labels: ,