Tomcat打开JMX,添加对JVM的监控。
1. 服务器关闭Tomcat
cd /opt/apache-tomcat-7.0.54/bin
./shutdown.sh
2. 进入Tomcat/bin目录,修改catalina.sh,找到如下内容“#—–Execute The Requested Command”,在其上添加以下配置,此配置不需要用户名、密码
CATALINA_OPTS=”$CATALINA_OPTS
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=10.1.13.82
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"
————————————————
ip是你要监控的tomcat所在服务器的ip地址
端口号,是你要开启的监控端口号。
ssl,false表示不使用ssl链接
authenticate,false表示不使用监控,即不需要用户名和密码
3.以下方式需要配置用户名、密码
CATALINA_OPTS=”$CATALINA_OPTS
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=10.1.13.82
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=true
-Dcom.sun.management.jmxremote.password.file=../conf/jmxremote.password
-Dcom.sun.management.jmxremote.access.file=../conf/jmxremote.access”
————————————————