jolokia / jolokia

JMX on Capsaicin
https://www.jolokia.org
Apache License 2.0
816 stars 223 forks source link

Document Configuring JMX Adapter #471

Open dboreham opened 3 years ago

dboreham commented 3 years ago

Apologies if this is document somewhere already. I'm interested in using the code in this PR to connect jconsole to my jolokia-enabled production JMVs. I'm lacking in deep JMX knowledge, but I get the impression that the idea here is to load a transport provider plugin class, or whatever is the correct terminology here, into a JMX client tool such as jconsole, such that it speaks to its target JVM using the jolokia protocol rather than stock JMX protocol (RMI over TCP?). This sounds great, but I have no idea how to a) get that code in place so the JMX tool can load it nor b) how to configure said tool to use the new transport. The YouTube videos hint that there is a URI scheme to target a specific transport (jolokia), then subsequent URI path is the jolokia URL. I'd be happy to write this doc if someone can provide me with some hints as to how to do the config. Thanks.

rhuss commented 3 years ago

good point, and a comprehensive documentation is definitely on the task list. In the meantime, could you give some hints about the usage of the connectors, @skarsaune ? We could use that then directly as input for the proper documentation.

skarsaune commented 3 years ago

Absolutely. Sorry, have been quite busy. It is in my list. Will reply with example soon

skarsaune commented 3 years ago

So for instance JConsole as the simplest tool, you could simply add jolokia-jmx-adapter-1.7.0-standalone.jar to the classpath as shown in this script (modify to the file location) https://github.com/rhuss/jolokia/blob/master/client/jmx-adapter/src/test/scripts/runJConsole.sh

Then you may connect by using the JMX service url : service:jmx:jolokia://hostname:portnumber/path/to/jolokia/

For VisualVM and JMC I am working on plugins that would allow you to include it without having to do any manual scripting.

For custom Java code you may see the Javadoc here: https://github.com/rhuss/jolokia/blob/12e67893483f7d99f9fbe12bd4b6972e28e5d5a1/client/jmx-adapter/src/main/java/org/jolokia/client/jmxadapter/JolokiaJmxConnectionProvider.java#L21

skarsaune commented 3 years ago

@dboreham : Feel free to try out the plugins for Java Mission Control. Let me know how it works for you. Installation instructions in the Readme : https://github.com/skarsaune/jmc-cloud-extensions

skarsaune commented 3 years ago

@dboreham : Here is a visualvm plugin that you can download: https://skarsaune.github.io/jolokia-jmc-update-site/visualvm/org-jolokia-jmx-plugin.nbm Be aware that flight recorder / diagnostic commands need a fix on either jolokia / visualvm side: https://github.com/oracle/visualvm/pull/352 But other operations run fine. Let me know how you fare ! :-)