jprofiler_监控远程linux服务器的tomcat进程(实践)


一、软件列表:
windows和linux的jprofiler的版本必须一致
1、jprofiler_linux_9_1_1.tar.gz
2、jprofiler_windows_x64 9_1_1  
3、本地安装tomcat7(windows)
4、linux安装tomcat7(linux)

二、操作步骤
1、将jprofiler_linux_9_1_1.tar.gz拷贝到linux /usr/local目录下,并使用tar命令解压
2、生成startup_jprofiler.sh文件(该文件最后会拷贝到linux的tomcat bin目录下,并执行脚本,才能监控tomcat)
 打开:Session-->Integration Wizards-->New Remote Integration
 
 
 
 
这里注意在linux手上开启端口8849
 
 这里需要定位到本机的tomcat bin目录下
 
 
 
3、拷贝startup_jprofiler.sh到linux的tomcat bin目录下
a) 脚本授权:chmod 777 startup_jprofiler.sh
b) 执行脚本:./startup_jprofiler.sh
执行脚本可能报错:Error occurred during initialization of VM
Could not find agent library /usr/local/bin/linux-x64/libjprofilerti.so in absolute path, with error: /usr/local/bin/linux-x64/libjprofilerti.so: cannot open shared object file: No such file or directory
原因:对应目录下找不到文件libjprofilerti.so
解决:
cd /usr/local/jprofiler9/bin/linux-x64
cp libjprofilerti.so /usr/local/bin/linux-x64/libjprofilerti.so
 c)  执行输出
 
windows下重新执行步骤1,最后选择立即执行即可
 

三、注意事项
1、执行脚本报错
执行脚本:./startup_jprofiler.sh
执行脚本可能报错:Error occurred during initialization of VM
Could not find agent library /usr/local/bin/linux-x64/libjprofilerti.so in absolute path, with error: /usr/local/bin/linux-x64/libjprofilerti.so: cannot open shared object file: No such file or directory
原因:对应目录下找不到文件libjprofilerti.so
解决:
cd /usr/local/jprofiler9/bin/linux-x64
cp libjprofilerti.so /usr/local/bin/linux-x64/libjprofilerti.so

2、jprofiler连接不上
原因:未开启默认端口8849
vim /etc/sysconfig/iptables
service iptables restart

四、参考资料





原文地址:https://www.cnblogs.com/gossip/p/6090979.html