A- Using Jstatd
Jstatd deamon is a process which comes with JDK. It can be used to remotely monitor jvm processes. It is possible to monitor any jvm processes without need to commanline parameters. However, it is limited when compared to JMX connection.
1- Create a jstatd.all.policy file in statd directory.
cd /usr/jdk/bin
touch jstatd.all.policy
vi jstatd.all.policy
Add following lines to jstatd.all.policy:
grant codebase "file:${java.home}/../lib/tools.jar" {
permission java.security.AllPermission;
};
2- Run jstatd daemon.
./jstatd -J-Djava.security.policy=jstatd.all.policy
3- In client machine, open Jvisualvm and goto Applications->Remote->Add Remote Host and enter ip address of remote machine hosting java process.
4- Right click newly added remote node and click “Add Jstatd connection...” .
5- Available process will be listed under newly created remote node. Select desired process and open.
B- JMX Connection
JMX connection is more usefull than Jstatd connection but it requires command line attributes at jvm startup.
1- Add following parameters to JVM parameters
-Dcom.sun.management.jmxremote=true
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=<jmxport>
-Djava.rmi.server.hostname=<host ip>
2- Make sure JMX port is opened
netstat –ntlp | grep jmxport
3- Make sure firewall is not blocking jmxport.
4- In client machine, open Jvisualvm and goto Applications->Remote->Add Remote Host and enter ip address of remote machine hosting java process, as in Usign Jstatd step 3.
5- Right click newly added remote node and Click Add JMX Connection.
Comments
Post a Comment