giltene / jHiccup

jHiccup is a non-intrusive instrumentation tool that logs and records platform "hiccups" - including the JVM stalls that often happen when Java applications are executed and/or any OS or hardware platform noise that may cause the running application to not be continuously runnable.
Other
677 stars 92 forks source link

failing to connect to remote process #26

Closed simonhf closed 7 years ago

simonhf commented 7 years ago

Trying to use jHiccup to monitor a Cassandra process but getting an error. Is there a way to attach? Or what are my alternative ways to monitor using jHiccup?

$ locate tools.jar
/usr/java/jdk1.7.0_76/lib/tools.jar $ ps jfax | egrep java 1 20400 20337 20337 ? -1 SLl 397 36362:24 /usr/java/jdk1.7.0_76/jre/bin/java -ea -javaagent:/usr/share/cassandra/lib/jamm-0.3.0.jar ... $ sudo ./jHiccup -p 20400
com.sun.tools.attach.AttachNotSupportedException: Unable to open socket file: target process not responding or HotSpot VM not loaded

giltene commented 7 years ago

Attaching to a live jvm works only if that target jvm is set up to allow it.

You can instrument you cassandra process with hiccup by adding it as a java agent in the cassandra config. For example, I often do this by adding the following line in cassandra-env.sh , right under the line for the jam agent:

JVM_OPTS=“$JVM_OPTS -javaagent://jHiccup.jar=-d,30000,-c,-l,//hiccup.%date.%pid.hlog”

[obviously, replace path and logpath with jHiccup path and the directory to which you want hiccup logs to go to]

simonhf commented 7 years ago

Thanks!