jconsole监控远程linux tomcat运行情况的配置
步骤如下:1.编辑tomcat/bin/catalina.sh
vi catalina.sh 在其中“
# ----- Execute The Requested Command -----------------------------------------”
之前插入新的一行(中间没有换行),内容如下:
CATALINA_OPTS="$CATALINA_OPTS -Djava.rmi.server.hostname=jdzz10.ucjoy.com -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=12345 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=true" 插入后,应该如图:
http://dl.iteye.com/upload/attachment/438931/82a5e74f-4503-3286-855a-0f4232e24bc6.bmp
(其中的选中部分为新增内容)
2.编辑jmxremote.access和jmxremote.password
cd /usr/java/jdk1.6.0_18/jre/lib/managementmv jmxremote.password.template jmxremote.password chmod 600 jmxremote.access jmxremote.passwordvi jmxremote.password jmxremote.access 一般保持原始内容不变即可。
对于jmxremote.password,将 其中的:
# monitorRole mzxwswj
# controlRole mzxwswj
井号注释取消掉。其中monitorRole为只拥有只读权限的角色,controlRole有更高权限:读写等等。
3.
a.最后将端口加入防火墙信任列表
vi /etc/sysconfig/iptables编辑iptables,加入新一行内容:-A RH-Firewall-1-INPUT -p tcp -m state --state NEW -m tcp --dport 12345 -j ACCEPT
如图(选中内容为新增的):
http://dl.iteye.com/upload/attachment/438953/f8d5cb56-c68a-3a47-a094-6d90f337e954.bmp
b.启动tomcat
/usr/local/tomcat/bin/startup.sh 而我们在上面配置的jmx代理就会随tomcat一起启动。
可以使用netstat -an | grep 12345命令查看端口是否正常启动。
至此,服务器端配置完毕。
4.使用windows客户机上的jconsole连接服务器端 进行监控。
打开C:\Program Files\Java\jdk1.6.0_10\bin\jconsole.exe,输入服务器端相关信息:
http://dl.iteye.com/upload/attachment/438957/8f133154-363c-3d8f-ac21-4e8f8a41e42e.bmp
点击“连接”,进入监控页面:
http://dl.iteye.com/upload/attachment/438961/644dce05-76d5-38fe-ae72-05828a08295c.bmp
页:
[1]