Windows客户端的Jprofiler7远程监控Linux上的Tomcat6
1.测试环境
服务器:RedHat Linux 5.5
Tomcat6.0.20,
Sun JDK 1.6.0_21,
JProfiler 7 forlinux(安装包:jprofiler_linux_7.sh)
客户端:Windows 7,
JProfiler 7 forwindows(安装包:jprofiler_windows_7.exe)
2.客户端 JProfiler 安装略
3.服务器端 JProfiler 安装:
把 jprofiler_linux_7.sh 上传到到服务器,假设路径为 /opt/jprofiler
1. chmod 777 赋予执行权限
2. 直接执行安装 ./文件名
按照提示来安装,提示都很简单,不在多说。安装路径选择 /usr/local/jprofiler7
4.客户端连接配置(中科软请忽略见下图)
1). 运行 JProfiler 。第一次打开会有向导,忽略它。
2). 选择 Session->Integration Wizard->NewRemote Integratation
3). 选择 On a remote computer;Platform of remote computer 选择 Linux x86/AMD 64;Next
4). 输入服务器 IP ;Next
5). 输入服务器上的 jprofiler 的安装路径,如/usr/local/jprofiler7 ;next
6). 选择服务器的 JDK 环境,这里是:Sun,1.5.0,hotspot;next
7). 输入端口:这里是默认值 8849;next
8). 选择启动模式:这里选第一种 wait for a connection from thejprofiler GUI;next
6.具体实现
6.服务器端的配置
(1)修改系统环境配置文件 /etc/profile ,增加
1.JPROFILER_HOME=/usr/local/jprofiler7/bin/linux-x86 (具体路径)
2. exportLD_LIBRARY_PATH=$LD_LIBRARY_PATH:$JPROFILER_HOME
然后source /etc/profile,使其生效
(2)修改TOMCAT启动文件catalina.sh,添加-agentlib:jprofilerti=port=8849-Xbootclasspath/a: /usr/local/jprofiler7/bin/agent.jar 内容到CATALINA_OPTS中;也就是将红色内容添加到catalina.sh,具体位置如下图
“-agentlib:jprofilerti=port=8849-Xbootclasspath/a:/opt/jprofiler4/bin/agent.jar ” 此内容由客户端软件生成
CATALINA_OPTS="$CATALINA_OPTS-Xms128m -Xmx128m $JPDA_OPTS -agentlib:jprofilerti=port=8849-Xbootclasspath/a:/usr/local/jprofiler7/bin/agent.jar"(具体路径)
8重启服务器