通过通过Tomcat开启开启JMX监控的方法图解监控的方法图解
主要介绍了Tomcat开启JMX监控,本文通过图文并茂的形式给大家介绍的非常详细,具有一定的参考借鉴价值,
需要的朋友可以参考下
搭建模拟环境:
操作系统:centos7
内存:1G
jdk:1.8.0_131
tomcat:8.0.48
环境准备我们这里就不直接演示了,直接配置tomcat的jmx
1、进入到tomcat的bin目录下
# cd /opt/tomcat/apache-tomcat-8.0.48/bin/
2、编辑配置文件
# vim catalina.sh
3、在下图中上面添加参数
参数添加后的样子
3.1、此配置连接jmx不需要账号密码:
CATALINA_OPTS="$CATALINA_OPTS
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=192.168.100.117
-Dcom.sun.management.jmxremote.port=9999
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false"
配置后的截图:
参数说明:
hostname:是监控tomcat所在服务器的ip地址
jmxremote.port:端口号,是要开启的监控端口号
jmxremote.ssl:是否要开启ssl连接
authenticate:false表示监控不需要用户和密码
3.2、需要配置用户名、密码:
CATALINA_OPTS="$CATALINA_OPTS
-Dcom.sun.management.jmxremote
-Djava.rmi.server.hostname=192.168.100.117
-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"
配置后的截图:
参数说明:
authenticate:为true开启账号验证
access.file:权限文件路径
password.file:密码文件路径