VisualVM over ssh

Viewed 47858

I've read Visual VM remotely over ssh but I think I've not fully understood because it was not working for me :-( Please can someone give some example?

ssh -D 9696 login@ip.of.external.machine and visualvm.exe -J-Dnetbeans.system_socks_proxy=localhost:9696 -J-Djava.net.useSystemProxies=true starts visualvm, but no processes of external machine are shown (only the local ones like visualvm itself). Moreover sometimes (but not always) I got the message "channel 3: open failed: connect failed: Connection refused" in my ssh window.

Any help?

9 Answers

I know this question is old but i suggest the easier solution instead of using jstat.

just only use SSH and Jvisualvm

  1. ssh with sockproxy (ex ssh -D 6666 host@123.123.123.123 )
  2. run jvisualvm with sock ( jvisualvm.exe -J-DsocksProxyHost=localhost -J-DsocksProxyPort=6666 )
  3. add JXM host (ex : 234.234.234.234:16000 )

Use jvisualvm easy way to detect memory leak and monitor CPU, RAM of application

Google Cloud gcloud that works for me:

  • Create a SOCKS tunnel with putty/ssh (putty connection > ssh > tunnel > dynamic source port 61099 for ssh -D61099)
  • Java options (!remove all the other advice you have taken):
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
  • VisualVM: Tools > Options > Network > Manual > SOCKS Proxy: localhost port: 61099
  • Press OK, in applications tree, right click and "Add remote host"
  • !use the internal ip of the VM (10.128.x.x)
  • Right click that host node and add JMX
  • Enter 10.128.x.x:1099
Related