-
使用JMX对Tomcat测试包进行监控
资源介绍
catalina-jmx-remote.jar放到tomcat/lib目录下
如果是windows版本,编辑TOMCAT_HOME/bin/catalina.bat,在开头加入下面几行:
set CATALINA_OPTS=%CATALINA_OPTS% -Djava.rmi.server.hostname=JMX_HOST
set CATALINA_OPTS=%CATALINA_OPTS% -Djavax.management.builder.initial=
set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote=true
set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.port=JMX_PORT
set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.ssl=false
set CATALINA_OPTS=%CATALINA_OPTS% -Dcom.sun.management.jmxremote.authenticate=false
如果是linux
如果是linux版本,编辑TOMCAT_HOME/bin/catalina.sh,在开头加入下面几行:
CATALINA_OPTS="$CATALINA_OPTS -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=11111 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -Djava.rmi.server.hostname=192.168.7.150"
检测
java -jar cmdline-jmxclient-0.10.3.jar - 192.168.16.64:11111 java.lang:type=Memory NonHeapMemoryUsage
05/24/2014 15:42:02 +0800 org.archive.jmx.Client NonHeapMemoryUsage:
committed: 47316992
init: 24313856
max: 136314880
used: 47012784
//运行时间
java -jar cmdline-jmxclient-0.10.3.jar - 192.168.16.64:11111 Catalina:type=Runtime Uptime
//虚拟机
//进程 CPU 时间
java -jar cmdline-jmxclient-0.10.3.jar - 192.168.16.64:11111 java.lang:type=OperatingSystem ProcessCpuTime
//进程 CPU 占用率
java -jar cmdline-jmxclient-0.10.3.jar - 192.168.16.64:11111 java.lang:type=OperatingSystem ProcessCpuLoad
- 上一篇: spring-data-redis2.jar
- 下一篇:没有了