JVISUALVM monitoring remote Linux under Tomcat
1. Edit tomcat/bin/catalina.sh
Add the following code with no line break in the middle:
catalina_opts= "$CATALINA _opts-djava.rmi.server.hostname=192.168.1.11-dcom.sun.management.jmxremote- dcom.sun.management.jmxremote.port=12345 -dcom.sun.management.jmxremote.ssl=false- Dcom.sun.management.jmxremote.authenticate=true "
You can search for execute with the/string command, adding to the note above the execute the requested command.
Note that hostname is the Tomcat server Ip,port is the monitoring port.
2. Edit Jmxremote.access and Jmxremote.password
These two files are inside the JDK and can be found through the%java_home%/jre/lib/management directory.
There is a jmxremote.password.template file that is renamed to Jmxremote.password, which is the user name password that controls the remote connection.
Then chmod to these two files, chmod 777 file name
Last VI Jmxremote.password, modify the following two lines to remove the note #:
# Monitorrole XXXXXX
# Controlrole XXXXXX
Monitorrole is the view role, with read-only permission, XXXXXX is the password that is set.
Controlrole is the control user, has read and write permissions, XXXXXX is the password set.
Finally, if the firewall is turned on, add the port to the Firewall trust list
Add the following line to the/etc/sysconfig/iptables
-A rh-firewall-1-input-p tcp-m state--state new-m TCP--dport 12345-j ACCEPT
You can also add them directly with the iptables command.
After you start Tomcat, the 12345 port you just set is on the listening state.
To run on a single server:
Win+r, input JVISUALVM run, start the monitoring interface:
1. Add remote host, remote, enter host ip:192.168.1.11
2. Add a JMX connection to the host right, enter the port number: 12345
User name Controlrole, password xxxxxx
Connection Successful!
JVISUALVM monitoring remote Linux under Tomcat