Jconsole 监控linux下的tomcat

来源:互联网 发布:java 策略模式 编辑:程序博客网 时间:2024/05/16 17:27

第一、linux系统先安装jprofiler服务端

下载地址:http://download.csdn.net/detail/fanjeff/8962879
安装过程,回车或者按Y,一直下一步知道安装完成。
vi /etc/profile
在最后增加
JPROFILER_HOME=/opt/jprofiler8/bin/linux-x64(注意32和64位)
export LD_LIBRARY_PATH=$JPROFILER_HOME
第二、jprofiler连接tomcat
1). 运行 JProfiler 。第一次打开会有向导,忽略它。 
2). 选择 Session->Integration Wizard->New Remote Integratation 
3). 选择 On a remote computer;Platform of remote computer 选择 Linux x86/AMD 64;Next 
4). 输入服务器 IP ;Next 
5). 输入服务器上的 jprofiler 的安装路径,如 /opt/jprofiler4 ;next 
6). 选择服务器的 JDK 环境,这里是:Sun,1.5.0,hotspot;next 
7). 输入端口:这里是默认值 8849;next 
8). 选择启动模式:这里选第一种 wait for a connection from the jprofiler GUI;next 
9). 这里会列出需要在服务器端做的配置:
(1) Please insert-agentlib:jprofilerti=port=8849  -Xbootclasspath/a:/opt/jprofiler4/bin/agent.jarinto the start command of your remote application right after the java command.把中间这句话复制下来。
第三、修改tomcat下的catalina.sh
把上一步复制的增加到变量JAVA_OPTS中
JAVA_OPTS="$JAVA_OPTS -agentpath:/opt/jprofiler8/bin/linux-x64/libjprofilerti.so=port=8849"
启动tomcat
0 0