Jvisualvm.exe monitoring Tomcat, JDK configuration

Source: Internet
Author: User
Tags visualvm

Local monitoring: Whenever a Java program is opened, it is automatically added to local monitoring.
Remote monitoring: To remote monitoring, the local VISUALVM must and the remote JVM to communicate, VISUALVM currently supports two remote connection mode.
The JSTATD and Jmx methods are:


Connecting a remote machine via JMX requires the following configuration:
1. Modify the remote machine JDK configuration file (I am here for the remote machine is Linux).
A. Enter the $java_home\jre\lib\management\ directory
B. Copy jmxremote.password.template this file to the current directory and rename it to Jmxremote.password
C. Open the Jmxremote.password file, remove the # monitorrole QED and # Controlrole R-R in front of these two lines of the comment symbol
2. Modify the configuration file for the program that needs to be monitored on the remote machine (I am here to monitor the application deployed within the Tomcat container).
A. Enter the Tomcat_home\bin directory
B. Open the catalina.sh file and add the following information:
For multiple Tomcat installations on a single server, java_opts changes to Catalina_opts
java_opts= "$JAVA _opts-djava.rmi.server.hostname=192.168.0.237
-dcom.sun.management.jmxremote.port=18999
-dcom.sun.management.jmxremote.ssl=false
-dcom.sun.management.jmxremote.authenticate=false "
-server-xms512m-xmx1024m-xmn256m-xx:permsize=256m-xx:maxpermsize=1024m
C. Restart the Tomcat service.
3. Client VISUALVM configuration (my client is using WinXP).
A. Direct anti-key Click Remote, select Add Remote Host ...
B. Enter the IP address (192.168.0.237) of the remote machine in the popup interface and the IP address will be added to the Remotes node.
C. Counter-click on this IP address, select Add JMX Connection, enter the port number (18999) that you just configured in the popup interface, and the connection will be added to the IP node.
D. Counter-click on this connection and select Open.


JSTATD configuration:
1. To configure JAVA secure access, save the following code as a file jstatd.all.policy into the $java_home/bin directory:
Grant CodeBase "file:${java.home}/. /lib/tools.jar "{
Permission java.security.AllPermission;
};

2. Modify the IP address in the server Hosts file
For the Java VISUALVM to successfully connect to the remote server, the server side should set the native address to the IP address of the native in the/etc/hosts file.
Use the Hostname-i command to view, if the display is 127.0.0.1 or inconsistent with the native IP, you need to change the corresponding address in the/etc/hosts file to the native real IP.
Modify the/etc/hosts file: Add a row to the next line in 127.0.0.1, native IP domain name/hostname alias
3. Then start the RMI service with the following command:
Jstatd-j-djava.security.policy=jstatd.all.policy
or create a script file under the $java_home/bin directory startjstatd.sh:
Nohup./jstatd-j-djava.security.policy=jstatd.all.policy &
This command runs the JSTATD service background and outputs the log file to the Nohup.out directory;
4. Establish a connection in VISUALVM to see JMX and JSTATD

At this point you can see the monitoring interface, from the interface we can see the CPU information, memory information, statistics load class number, thread information.

Jvisualvm.exe monitoring Tomcat, JDK configuration

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.