JMX command line value for command line

I am using JMX Client Command to be able to query ActiveMQ Server. At the same time, I want to be able to dynamically set values ​​on the server. e.g. MemoryLimit .

Is it possible to set values ​​through the JMX command line client, if so, how can I set a memory limit?

Here is how I was able to request.

java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 org.apache.activemq:BrokerName=defaultBroker,Destination=Testing,Type=Queue MemoryLimit 

but how can I install memorylimit?

I tried the following:

 java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 org.apache.activemq:BrokerName=defaultBroker,Destination=Testing,Type=Queue setMemoryLimit=300000` 

and failed as shown below.

11/18/2011 11:56:28 -0800 org.archive.jmx.Client setMemoryLimit = 300000: operation setMemoryLimit not found.

+4
source share
1 answer

Edit

I would recommend removing this jmxclient and switching to:

http://wiki.cyclopsgroup.org/jmxterm

It looks like supported and better documented. I suspect it will work and give you access to setters - if they exist.


If the installed method exists, 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 configuration and retrieval, I would use jconsole. If you use java6 + jconsole, in the field click on the bean from which you want to get information. This should show you an ObjectName for use on the command line. Then, if you open the attribute list, the attribute name must have the corresponding get method. If the color value is blue, then the appropriate method must be set.

For example, if you open the java.lang folder in jconsole, you can click ClassLoading . This shows that ObjectName used by 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 getters and setters. This is 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 of cmdline-jmxclient does not know how to do boolean so that it does not appear as a setter. If so, you should be able to:

 java -jar cmdline-jmxclient-0.10.3.jar - localhost:1099 \ java.lang:type=ClassLoading setVerbose=true 
+7
source

Source: https://habr.com/ru/post/1381953/


All Articles