JProfiler入門教程(4)--JProfiler遠端監控Tomcat效能
阿新 • • 發佈:2018-11-02
很多時候我們的應用都是跑在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版本,網上的註冊碼大多都可以用,也可以實現遠端監控。