1) Normal installation of JDK and Tomcat configuration environment variables (this step is skipped)
2) Configuring JMX Access Files
# CD $CATALINA _home/conf/
# CP $JAVA _home/jre/lib/management/jmxremote.password.template Jmxremote.password
# chmod Jmxremote.password (be sure to note that this file is not writable by default)
# VI $CATALINA _home/conf/jmxremote.password
Add a user at the bottom (the first is the user name the second one is the password)
Fox 123456
# chmod Jmxremote.password (requires that the file is not writable by any user)
# CP $JAVA _home/jre/lib/management/jmxremote.access jmxremote.access
# VI jmxremote.access (this file is authorized for JMX users)
To the last row
Monitorrole readonly
Controlrole ReadWrite
Note Change to
# monitorrole ReadOnly
# Controlrole ReadWrite
Then add a row at the end
Fox ReadWrite
# chmod Jmxremote.access
3) Configure Tomcat boot parameters
# CD $CATALINA _home/bin
# VI catalina.sh
Find the following line
#-----Execute The requested Command-----------------------------------------
Add a script above it at the end of the goal is to follow the previous java_opts and Catalina_home variable settings (especially the heap memory parameter settings) Online article said there is a direct setting java_opts but this setting will be thrown when the stop is abnormal While not affecting the use of
(Parameter meaning is:
-dcom.sun.management.jmxremote Enable JMX remote monitoring
-dcom.sun.management.jmxremote.port=9004 using port 9004 (can be arbitrarily specified as long as there is no conflict)
-dcom.sun.management.jmxremote.authenticate=true remote connection requires password authentication
-dcom.sun.management.jmxremote.ssl=false does not use SSL (SSL I have tried many times without configuration success: P temporarily does not open)
-dcom.sun.management.jmxremote.access.file= $CATALINA _home/conf/jmxremote.access using the specified JMX account authorization file
-dcom.sun.management.jmxremote.password.file= $CATALINA _home/conf/jmxremote.password using the specified JMX account file)
#-----JMX Config Start-----
If ["$" = "Run"]; Then
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=10207- Dcom.sun.management.jmxremote.authenticate=true-dcom.sun.management.jmxremote.ssl=false- dcom.sun.management.jmxremote.access.file= $CATALINA _home/conf/jmxremote.access- dcom.sun.management.jmxremote.password.file= $CATALINA _home/conf/jmxremote.password "
elif ["$" = "start"]; Then
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=10207- Dcom.sun.management.jmxremote.authenticate=true-dcom.sun.management.jmxremote.ssl=false- dcom.sun.management.jmxremote.access.file= $CATALINA _home/conf/jmxremote.access- dcom.sun.management.jmxremote.password.file= $CATALINA _home/conf/jmxremote.password "
Fi
#-----JMX Config End-----
This means that you need to add the following code to the catalina.sh under Tomcat's bin.
#-----JMX Config Start-----
If ["$" = "Run"]; Then
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=10207- Dcom.sun.management.jmxremote.authenticate=true-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.access.file=/usr/java/jdk1.6.0_32/jre/lib/management/jmxremote.access- Dcom.sun.management.jmxremote.password.file=/usr/java/jdk1.6.0_32/jre/lib/management/jmxremote.password "
elif ["$" = "start"]; Then
java_opts= "$JAVA _opts-dcom.sun.management.jmxremote-dcom.sun.management.jmxremote.port=10207- Dcom.sun.management.jmxremote.authenticate=true-dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.access.file=/usr/java/jdk1.6.0_32/jre/lib/management/jmxremote.access- Dcom.sun.management.jmxremote.password.file=/usr/java/jdk1.6.0_32/jre/lib/management/jmxremote.password "
Fi
#-----JMX Config End-----
Export Java_opts (important)
And all we have to do is get into the/usr/java/jdk1.6.0_32/jre/lib/management.
There is a template, copy one as Jmxremote.password, remember, this file permissions is very special, I use the time of 400
Remember Jmsremote.password last
Monitorrole QED
Controlrole
Before the comments removed (the system comes with the account and password, it is recommended to add a new, when the new time remember to pay the account read and write access to jmxremote.access)
And then it's ready.
And then pay attention to hostname that part, should be directly in the client input jconsole and then enter the IP address, port, account number, password, you can monitor Tomcat
Thanks again @ The dead water fox great God
Vi/etc/hosts Modify host name for the external IP address, this is very important, or not connected ...
Windows access to Linux Server Tomcat: Monitor tomcat with JVISUALVM with JDK
Linux Configuration jmx Monitoring TOMCAT7