JProfile 9.2 linux安裝及windows客戶端遠端監控
1. 測試環境
伺服器:Linux X64;tomcat 7.0;jdk 1.7;jprofiler_linux_9_2.sh
客戶端:Windows10;jprofiler_windows-x64_9_2.exe
2. JProfiler軟體下載地址:http://www.ej-technologies.com/download/jprofiler/files
3. 客戶端 JProfiler 安裝 略
4. 伺服器端 JProfiler 安裝:
把 jprofiler_linux_9_2.sh 上傳到到伺服器,假設路徑為 /home/devweb/soft
# cd/home/devweb/soft
# chmod +x
jprofiler_linux_9_2.sh
# ./
jprofiler_linux_9_2.sh -c
注意,這裡的-c意思是用字元方式來安裝,如果機器上沒有X,則加上該引數
提示:
(1) 下載的伺服器和客戶端版本必須符合作業系統的型別,jprofiler支援作業系統型別為windows、MAC os、linux、Solaris、Aix、FreeBSD、HP-UX;
(2) 客戶端需要licence,可以通過在網站上輸入使用者名稱和郵箱來獲取試用版licence,伺服器端不需要licence;
(3) 客戶端和伺服器端的版本號要一致,此例中均為9.2
5. 客戶端連線配置:
(1) 執行 Jprofiler,使用嚮導配置,或者選擇Session->Integration Wizard->New Remote Integratation;
(2) 選擇伺服器作業系統內容:
(3)選擇JDK資訊:
(4)選擇啟動模式:
(5) 輸入伺服器IP地址
(6)輸入伺服器中jprofiler的安裝路徑:
(7)輸入伺服器中jprofiler的埠號:
(8) 最後生成一個配置說明(這個很重要!!!):
按照以上配置說明的含義是:
首先,在配置結束後將客戶端自動生成的配置檔案(一般
其次,將生成的啟動項引數加入伺服器端的啟動檔案中(tomcat是catalina.sh或startup.sh)
JAVA_OPTS="$JAVA_OPTS -agentlib:jprofilerti=port=8849,nowait,id=118,config=/home/devweb/jprofiler9/config/config.xml -Xbootclasspath/a:/home/devweb/jprofiler9/bin/agent.jar "
其中id=118為config.xml中生成的id
再次,新增jprofiler相關環境變數
修改環境變數配置檔案.bash_profile
JPROFILER_HOME=/home/devweb/jprofiler9export LD_LIBRARY_PATH=$JPROFILER_HOME/bin/linux-x64
source
.bash_profile 使之生效
提示:
(1) 如果以上所有步驟都完成之後,啟動這個session監控,報連線失敗的錯誤,一般情況下需要檢查伺服器端jprofiler相關環境變數配置是否已經配置,或者是否即時生效了;另外一種情況有可能是新增jprofiler的啟動項引數不正確;
(2) 如果報JProfiler> Could not find session with id: 128的提示,說明執行java程式時,VM引數-agentlib:jprofilerti=port=8849,nowait,id=128,中最後指定的ID有誤。將其修改為與config.Xml中指定的<session id="XX" name="XX" ....>...</session>相匹配的ID;
(3) 如果出現License Key Not Valid的情況,則找到正確的Key,將其寫入到config.xml中即可。不過這個key與windows版本破解時得到的key不同,可以考慮去jprofiler的官網上申請試用版的key。
6. 全部配置完成之後,可以啟動客戶端的jprofiler,選擇session>start
center>Open Session
Available session configurations中列出了剛才配置的連線,選中使用就OK了!!
啟動時伺服器端日誌輸出包括以下內容:
JProfiler> Protocol version 27
JProfiler> Using JVMTI
JProfiler> 32-bit library
JProfiler> Don't wait for frontend to connect.
JProfiler> Using config file /zpool1/gpdb_m/crmtest/menglr_18092/jprofiler5/config/config.xml (id: 105)
JProfiler> Listening on port: 8849.
JProfiler> Native library initialized
JProfiler> VM initialized
JProfiler> Using dynamic instrumentation
JProfiler> Time measurement: elapsed time
JProfiler> CPU profiling enabled
JProfiler> Hotspot compiler enabled
JProfiler> Starting org/apache/catalina/startup/Bootstrap ...
當jprofiler終端監控時,會出現:
JProfiler> Disconnected. Waiting for reconnection.
JProfiler> Listening on port: 8849