Linux tomcat jvm 远程监控

来源:互联网 发布:ds1302数据手册 编辑:程序博客网 时间:2024/05/17 21:41

1、 tomcat/bin/catalina.sh文件添加如下内容 
CATALINA_OPTS=”$CATALINA_OPTS -Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=10.1.1.10 -Dcom.sun.management.jmxremote.port=7003 -Dcom.sun.management.jmxremote.rmi.port=7003 -Dcom.sun.management.jmxremote.authenticate=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.password.file=/workspace/config/jvmpassword.cfg -Dcom.sun.management.jmxremote.access.file=/workspace/config/jvmaccess.cfg”

参数说明: 
-Dcom.sun.management.jmxremote //启动原程访问 
-Djava.rmi.server.hostname=10.1.1.10 //服务器地址 
-Dcom.sun.management.jmxremote.port=7003 //远程端口 
-Dcom.sun.management.jmxremote.authenticate=true //是否鉴权 
-Dcom.sun.management.jmxremote.ssl=false //是否ssl 
-Dcom.sun.management.jmxremote.password.file=/workspace/config/jvmpassword.cfg //密码文件 
-Dcom.sun.management.jmxremote.access.file=/workspace/config/jvmaccess.cfg //用户名及其权限

2、添加权限文件 jvmpassword.cfg 和jvmaccess.cfg 
jvmpassword.cfg内容为(用户名,密码) 
monitor a123456 
controller a654321

jvmaccess.cfg内容为(用户名,控制权限) 
monitor readonly 
controller readwrite

3、设置jvmpassword和jvmaccess的文件权限,不然无法访问 
chmod 600 jvm*

⚠注意: 
本文采用tomcat 8.5版本 
外网远程访问:需要在tomcat/lib/下添加jmx remote.jar 
wget http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.2/bin/extras/catalina-jmx-remote.jar

阅读全文
0 0