It seems that I've never got this to work in the past. Currently, I KNOW it doesn't work.
But we start up our Java process:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=6002
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
I can telnet to the port, and "something is there" (that is, if I don't start the process, nothing answers, but if I do, it does), but I can not get JConsole to work filling in the IP and port.
Seems like it should be so simple, but no errors, no noise, no nothing. Just doesn't work.
Anyone know the hot tip for this?
There are already some great answers here, but, there is a slightly simpler approach that I think it is worth sharing.
sushicutta's approach is good, but is very manual as you have to get the RMI Port every time. Thankfully, we can work around that by using a SOCKS proxy rather than explicitly opening the port tunnels. The downside of this approach is JMX app you run on your machine needs to be able to be configured to use a Proxy. Most processes you can do this from adding java properties, but, some apps don't support this.
Steps:
Add the JMX options to the startup script for your remote Java service:
Set up a SOCKS proxy connection to your remote machine:
Configure your local Java monitoring app to use the SOCKS proxy (localhost:9696). Note: You can sometimes do this from the command line, i.e.:
When testing/debugging/diagnosing remote JMX problems, first always try to connect on the same host that contains the MBeanServer (i.e. localhost), to rule out network and other non-JMX specific problems.
These are the steps that worked for me (debian behind firewall on the server side, reached over VPN from my local Mac):
check server ip
use JVM params:
run application
find pid of the running java process
check all ports used by JMX/RMI
open all ports from step 5 on the firewall
Voila.
Tried with Java 8
This solution works well also with firewalls
1. Add this to your java startup script on remote-host:
2. Execute this on your computer.
Windows users:
putty.exe -ssh user@remote-host -L 1616:remote-host:1616
Linux and Mac Users:
ssh user@remote-host -L 1616:remote-host:1616
3. Start
jconsole
on your computer4. Have fun!
P.S.: during step 2, using
ssh
and-L
you specify that the port 1616 on the local (client) host must be forwarded to the remote side. This is an ssh tunnel and helps to avoids firewalls or various networks problems.After putting my Google-fu to the test for the last couple of days, I was finally able to get this to work after compiling answers from Stack Overflow and this page http://help.boomi.com/atomsphere/GUID-F787998C-53C8-4662-AA06-8B1D32F9D55B.html.
Reposting from the Dell Boomi page:
The one line that I haven't seen any Stack Overflow answer cover is
In my case, I was attempting to retrieve Kakfa metrics, so I simply changed the above option to match the
-Dcom.sun.management.jmxremote.port
value. So, without authentication of any kind, the bare minimum config should look like this:I'm trying to JMC to run the Flight Recorder (JFR) to profile NiFi on a remote server that doesn't offer a graphical environment on which to run JMC.
Based on the other answers given here, and upon much trial and error, here is what I'm supplying to the JVM (conf/bootstrap.conf)when I launch NiFi:
I did put this in /etc/hosts, though I doubt it's needed:
Then, upon launching JMC, I create a remote connection with these properties:
Incidentally, if I click the Custom JMX service URL, I see:
This finally did it for me.