Ext: VISUALVM Monitor the Java program on the remote machine

Source: Internet
Author: User
Tags visualvm

Transferred from: http://hanwangkun.iteye.com/blog/1195526

The JDK itself has a lot of monitoring tools, such as Jconsole. The tool we are going to talk about today is VISUALVM, which is one of them. But this tool is only in JDK1.6.07 and above. It is a good free monitoring tool to monitor the JVM heap, thread, class loading situation and JVM GC condition of Java programs.

Monitoring range: JDK1.4 and above versions of the program can be monitored.

It is called in the JDK: JVISUALVM, of course, we can go to its official website to download the latest version of it, the current latest version is:

1.3.2, as shown below:

Its official website address is listed in the diagram:

Http://visualvm.java.net

First, open VISUALVM, which automatically retrieves the Java application on the local machine, such as:

Double-click on it to start monitoring the data.

But monitoring the Java application on the remote machine is not so simple and needs to be configured accordingly, first we look at the principle of VISUALVM monitoring the Java application on the remote machine:



It is known that the VISUALVM must use the JSTATD service to obtain operational data for the Java application on the remote machine.

So we have to start the JSTATD service on the machine to be monitored (this service is started on the remote machine)

1. First configure the Java environment on the remote machine:

Java_home,classpath,path

After configuration, in CMD through: java-version and javac-version, determine the Java environment configuration is complete

2, create a file: Jstatd.all.policy (the name can be changed, the extension can not be changed), the contents are as follows:

Grant CodeBase "file:${java.home}/. /lib/tools.jar "{

Permission java.security.AllPermission;

};

The purpose of this file is to allow the JSTATD service to read the running data of the Java application on the machine.

3, put this file in:%java_home%\bin directory.

4. Open cmd, cut the directory to:%java_home%\bin directory, then execute the following command:

Jstatd-j-djava.security.policy=jstatd.all.policy

This time, if CMD is the state shown below, then the JSTATD service started successfully



Note: The JSTATD service started above, the default port is 1099, you can also specify the port number in the command above

After starting the JSTATD service on the remote machine according to the above schematic diagram, VISUALVM can monitor the Java application on the remote machines, as follows:

1. Add the remote host on the local VISUALVM interface:

In the application on the left, right-click Remote, select Add remote host



Then enter the IP of the remote host you want to monitor in the popup dialog box, as follows:



Just start to enter, not this dialog box, click "Advanced Settings" will expand the rest of the section, is the above dialog box, in which you can set the remote machine on the JSTATD service on the port number, the default is 1099, you can check "display name", in the inside enter their desired remote host name, Finally click OK.

2. Expand the newly created remote host to see the Java application running on the remote machine, as shown below:



By double-clicking the application inside, you can monitor it like a local application.

By this, the VISUALVM Remote monitoring section is complete.

The last thing to note is that theVISUALVM on the JDK6 is not able to monitor the Java application on the JDK7, even if the JSTATD service starts successfully.

Ext: VISUALVM Monitor the Java program on the remote machine

Related Article

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.