很多时候我们的应用都是跑在linux,而jProfiler是安装在windows上面,这时候我们就需要通过配置远程连接对服务器上面的应用进行监控。

环境:Centos Linux 7.3、tomcat 8.0、jdk1.8.0_181、jprofiler_windows-x64_10_1_4

1,在linux上安装jProfiler
从官网下载安装包:jprofiler_linux_10_1_4.tar.gz,软件版本要和windows版保持一致,然后上传到linux服务器并解压。

tar -zvxf jprofiler_linux_10_1_4.tar.gz

我是安装到/opt/jprofiler10.1.4目录下

2,修改tomcat配置
进入tomcat的bin目录,修改catalina.sh文件,在文件开始增加如下配置:

CATALINA_OPTS="-agentpath/opt/jprofiler10.1.4/bin/linux-x64/libjprofilerti.so=port=10010,nowait"

然后启动tomcat,在tomcat日志文件中会输出jprofiler的启动日志

JProfiler> Protocol version 59
JProfiler> JVMTI version 1.1 detected.
JProfiler> Don't wait for frontend to connect.
JProfiler> 64-bit library
JProfiler> Starting up without initial configuration.
JProfiler> Listening on port: 10010.
JProfiler> Enabling native methods instrumentation.
JProfiler> Can retransform classes.
JProfiler> Can retransform any class.
JProfiler> Native library initialized
JProfiler> VM initialized

3,在windows上创建监控
打开jprofiler程序,在Session菜单中打开“Integration Wizards”,选择“New Remote Integration”,打开配置对话框。
在这里插入图片描述

设置jdk版本
在这里插入图片描述

在这里插入图片描述

设置连接地址

设置linux中jprofiler安装路径
在这里插入图片描述

设置端口
在这里插入图片描述

查看配置汇总信息
在这里插入图片描述

启动监控
在这里插入图片描述

注意:
远程监控需要有效的注册码,否则会报“JProfiler> ERROR: Invalid license key. Aborting.”错误。我从网上找了几个注册码,都没有用,后来安装的时候选择试用,可以实现远程监控,但是试用期只有10天。
经过反复试验,建议大家安装JProfiler9.2.1版本,网上的注册码大多都可以用,也可以实现远程监控。

Logo

更多推荐