VISUALVM is a tool for performance tuning to monitor, display local, or remote server JVM work. With VISUALVM, we can monitor the various sub-pools of JVM memory, CPU, garbage collector, and so on, to discover potential leak points and configuration problems in program code.
There are two ways to connect to the remote monitoring Linux JVM:
CentOS6.5 Installation: Yum install JAVA-1.8.0-OPENJDK Java-1.8.0-openjdk-devel
Ubuntu12.04 Installation: sudo apt-get install JAVA-7-OPENJDK
Mode 1: Start RMI service via JSTATD
1. Turn on remote monitoring access, remove the comments below, Ubuntu and CentOS Java installation paths are different, the other configuration is basically the same.
(Ubuntu)
# Vi/etc/java-7-openjdk/management/jmxremote.password Monitorrole QED controlrole R
(CentOS)
# cd/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.31-1.b13.el6_6.x86_64/jre/lib/management/# CP Jmxremote.password.template jmxremote.password# chmod 644 jmxremote.password# VI jmxremote.passwordmonitorrole QED C Ontrolrole
2.JSTATD Start with daemon process
# jstatd -j-djava.rmi.server.hostname=192.168.1.156 &# could not create remote objectaccess denied ("Java.util.PropertyPermission" " Java.rmi.server.ignoreSubClasses " " write ") java.security.accesscontrolexception: access denied ("java.util.PropertyPermission" "java.rmi.server.ignoreSubClasses" "write") at java.security.accesscontrolcontext.checkpermission ( accesscontrolcontext.java:372) at Java.security.AccessController.checkPermission (accesscontroller.java:559) at java.lang.securitymanager.checkpermission (securitymanager.java:549) at java.lang.system.setproperty (system.java:783) at sun.tools.jstatd.jstatd.main (jstatd.java:139)
There is an error, said no permission, so Baidu, find a solution, you can normally start, as follows:
# cd/tmp# VI jstatd.all.policygrant codebase "file:${java.home}/. /lib/tools.jar "{permission java.security.AllPermission;}; # jstatd-j-djava.security.policy=jstatd.all.policy-j-djava.rmi.server.hostname=192.168.1.156 &
Open the JVISUALVM tool (default port 1099)-Add a remote host--dual-machine host IP to monitor
CPU graphics are not displayed, not supported by this JVM, there is no reason to find, have known Bo friends, also please inform the next, thank you!
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/59/02/wKiom1TERXnT2A5RAAZz4IfE-2E179.jpg "title=" QQ picture 20150125092242.jpg "alt=" Wkiom1terxnt2a5raazz4ife-2e179.jpg "/>
2:JMX mode monitoring application, we take Tomcat as an example (common)
# cd/root/apache-tomcat-8.0.17/bin# VI catalina.sh #找到JAVA_OPTS, added below, added location does not require #java_opts= "$JAVA _opts- dorg.apache.catalina.security.securitylistener.umask= ' UMASK ' "java_opts=" $JAVA _ Opts-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=9999-dcom.sun.management.jmxremote . authenticate=false-dcom.sun.management.jmxremote.ssl=false-djava.rmi.server.hostname=192.168.1.156 "#./ startup.sh # NETSTAT-ANTP |grep 9999 #查看端口是否监听
Open the JVISUALVM tool--Add a remote host--Add a JMX connection to the remote host--Full port, confirm
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/59/02/wKiom1TESjugXERQAAdJO8Fa6Gs528.jpg "title=" QQ picture 20150125094300.jpg "alt=" Wkiom1tesjugxerqaadjo8fa6gs528.jpg "/>
This article is from the "Penguin" blog, please be sure to keep this source http://lizhenliang.blog.51cto.com/7876557/1608005
Java VISUALVM Remote Monitoring JVM