I m using Command-line JMX Client to be able to query ActiveMQ Server. At the same time I want to be able to set values dynamically to the server. such as MemoryLimit.
Is it possible to set values via Command-Line JMX client, if yes , how can i set the memory limit?
This is how i was able to query.
java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 org.apache.activemq:BrokerName=defaultBroker,Destination=Testing,Type=Queue MemoryLimit
but how can i set memorylimit?
I tried below:
java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 org.apache.activemq:BrokerName=defaultBroker,Destination=Testing,Type=Queue setMemoryLimit=300000`
and failed as below.
11/18/2011 11:56:28 -0800 org.archive.jmx.Client setMemoryLimit=300000: Operation setMemoryLimit not found.
The jconsole executable can be found in JDK_HOME/bin, where JDK_HOME is the directory in which the Java Development Kit (JDK) is installed. If this directory is in your system path, you can start JConsole by simply typing jconsole in a command (shell) prompt.
This cmdline-jmxclient can be used to connect to the SUN JVM JDK 1.5. 0 JMX Agent to set logging levels remotely and to get information on the running JVM. It can also be used to remotely control Heritrix (Heritrix starts the SUN JVM JDK 1.5. 0 JMX Agent when its run under SUN JDK 1.5.
The console is accessible at http://localhost:8080/jmx-console. The JMX Console provides a raw view of the JMX MBeans which make up the server.
Edit
I'd recommend dropping that jmxclient and switching to:
http://wiki.cyclopsgroup.org/jmxterm
It looks to be supported and better documented. I suspect that it will work and give you access to the setters -- if they exist.
If the set method does exist then the following should work:
java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 \
org.apache.activemq:BrokerName=defaultBroker,Destination=Testing,Type=Queue \
setMemoryLimit=...
Here are the docs:
http://crawler.archive.org/cmdline-jmxclient/
To find out which attributes are available for setting and getting, I'd use jconsole. If you are using a Java6+ jconsole, you field click on the bean you want to get information from. That should show you the ObjectName
to use on the command line. Then if you open the attributes list, the name of the attribute should have a corresponding get method. If the value is colored blue then there should be a corresponding set method.
For example, if you open up the java.lang
folder in jconsole, you should be able to click on ClassLoading
. That shows you the ObjectName
to use is java.lang:type=ClassLoading
. You can then do the following to list the various attributes and operations available:
java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 \
java.lang:type=ClassLoading
You should see the getters and the setters. Here's how you get the Verbose
attribute:
java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 \
java.lang:type=ClassLoading Verbose
For some reason my version cmdline-jmxclient does not know how to do boolean
type so it doesn't show up as a setter. If it did you should be able to do:
java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 \
java.lang:type=ClassLoading setVerbose=true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With