Forked from laszlomiklosik/Using JSTATD deamon with VisualVM for remote profiling
Last active
November 25, 2024 13:37
-
-
Save Prussia/556b1182a9b5994a3763bf433f3b096f to your computer and use it in GitHub Desktop.
Using JSTATD deamon with VisualVM for remote profiling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1. create tools.policy file: | |
| grant { | |
| permission java.security.AllPermission; | |
| }; | |
| 2. run to start jstatd: | |
| jstatd -J-Djava.security.policy=tools.policy | |
| 3. check which port is run by jstatd: | |
| lsof -i | |
| useful article: | |
| http://hillert.blogspot.com/2010/01/remote-profiling-of-jboss-using.html | |
| http://stackoverflow.com/questions/7424519/using-visualvm-to-connect-to-a-remote-jstatd-instance-through-a-firewall | |
| Here’s the complete How-to for ubuntu hosts: | |
| 1. Get VisualVM, which also includes jstatd: | |
| sudo apt-get install visualvm | |
| 2. In your home directory create the file jstatd.all.policy: | |
| nano jstatd.all.policy | |
| 3. Fill it with the following content to grant access to every application from any side (if you need fine grained user access permissions, which you most probably will, please have a look at the docs): | |
| grant { | |
| permission java.security.AllPermission; | |
| }; | |
| 4. Start jstatd and tell it to expose the ip address of the machine running it (instead of using the DNS name): | |
| jstatd -J-Djava.security.policy=jstatd.all.policy\ | |
| -J-Djava.rmi.server.hostname=192.168.178.1 | |
| # -J-Djava.rmi.server.hostname=10.82.83.117 -J-Djava.rmi.server.logCalltrue | |
| 5. Now fire up VisualVM on another host and click on “File/Add Remote Host…” and enter the ip. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment