Remotely monitor the Linux server JVM with VISUALVM

Source: Internet
Author: User
Tags visualvm

Using VISUALVM to remotely monitor Linux server JVM One, JMX mode: 1. The first thing to do is to modify the configuration file for the JMX service in the JDK to get the appropriate permissions:

Enter the/jre/lib/management subdirectory of the root directory where the $java_home resides,
A. Copy the Jmxremote.password.template file as a Jmxremote.password
B. Adjust the permissions for jmxremote.access and Jmxremote.password to read-only, you can use the following command
chmod 600 jmxremote.access jmxremote.password
C. Open the Jmxremote.password file and remove

# monitorRole QED # controlRole R&D

The comment symbols in front of these two lines

2. Startup parameters

Start the parameter with the following parameters on the program that you want to listen on

-Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=[hostIp]-Dcom.sun.management.jmxremote.port:这个是配置远程connection的端口号的,要确定这个端口没有被占用  -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false:这两个是固定配置,是JMX的远程服务权限的  -Djava.rmi.server.hostname:这个是配置server的IP的,要使用server的IP最好在机器上先用hostname   –i看一下IP是不是机器本身的IP,如果是127.0.0.1的话要改一下,否则远程的时候连不上,目前我们的server上我已经都改好了  
3. Windows Client Configuration

The JDK comes with VISUALVM, just go into the bin directory to start
After startup the page is concise and the configuration is simple:

A. Click Add Remote Host on the left menu, enter the IP of the server, and then configure the port in the Advanced settings (note that the port is consistent with the port on the server)

B. Right-click the IP you just configured, select the JMX connection mode, and enter the port again to monitor the JVM resources.

Second, JSTATD way: 1. Create a new file under the Java installation bin (e.g./usr/local/java/jdk1.8.0_91/bin) on the server

File name is Jstatd.all.policy
The file contents are as follows

grant codebase "file:${java.home}/../lib/tools.jar" {permission java.security.AllPermission;};
2. Execute the following command in the current directory (BIN)
./jstatd -J-Djava.rmi.server.hostname=[hostIp] -J-Djava.security.policy=jstatd.all.policy -p 1100

The hostname in the command is the IP address of the server, and-P is the port, both of which need to be specified by themselves (using the default IP address and port command on the Internet, but I try to not take effect). If you do not specify a port. Then the default value for the port is 1099. After execution, use the Telnet command to test whether the port is listening. If everything is OK, the JSTATD service has been configured successfully.

3. Windows Client Configuration

Open the Visual VM software on your computer, right-click the Remote menu item in the left menu, and enter the destination server IP address to add a remote host. Then right-click on the new Host menu item and select "Add JSTATD Connection" in the popup menu. Enter the port number specified in the second step configuration in the text box in the popup dialog box (default is 1099)

Note: JMX Mode boot cannot use the Visual GC plug-in, the JSTATD method can be used but the CPU view is not available, so it can be used in conjunction with both, first enable JSTATD using port 1099, and then enable JMX on the application that needs listening to use additional ports

Remotely monitor the Linux server JVM with VISUALVM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.