Skip to content

Instantly share code, notes, and snippets.

@philk
Created September 23, 2011 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save philk/1238525 to your computer and use it in GitHub Desktop.
Save philk/1238525 to your computer and use it in GitHub Desktop.
jconsole function
function jc {
jmx_host=$1
jmx_port=${2:-8080}
proxy_host=${3:-$jmx_host}
proxy_port=${4:-8123}
echo "connecting jconsole to $jmx_host:$jmx_port via SOCKS proxy $proxy_host using local port $proxy_port"
ssh -f -ND $proxy_port $proxy_host
jconsole -J-DsocksProxyHost=localhost -J-DsocksProxyPort=${proxy_port} service:jmx:rmi:///jndi/rmi://${jmx_host}:${jmx_port}/jmxrmi
kill $(ps ax | grep "[s]sh -f -ND $proxy_port" | awk '{print $1}')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment