Environment
CentOS release 6.5 (Final)
PHP 5.5.11
Requirement Package
因安裝 Dynatrace Client 需要有 Java 的環境,所以要須先安裝
yum install -y java-1.7.0-openjdk
註記: 在
CentOS 7
上,也可以裝這個版本 java-1.8.0-openjdk
Download Dynatrace Package
先下載 Dynatrace Client 套件,
dynatrace-agent-6.2.0.1239-unix.jar
和 dynatrace-wsagent-6.2.0.1239-linux-x64.tar
即可Setting
先解壓縮這二個壓縮檔至
/opt
底下$ tar -xvf dynatrace-wsagent-6.2.0.1239-linux-x64.tar -C /opt
$ mkdir -p /opt/dynatrace-6.2
$ java -jar dynatrace-agent-6.2.0.1239-unix.jar
-----------------------------------------------------------------------------
dynaTrace 6.2 Installer
-----------------------------------------------------------------------------
platform: Linux 2.6.32-431.29.2.el6.x86_64, amd64
-----------------------------------------------------------------------------
Installer is running with JVM version 1.7.0_65
-----------------------------------------------------------------------------
Detected OS/Arch: linux
-----------------------------------------------------------------------------
The product will be installed to /home/daniel_lin/dynatrace-6.2. Do you want to install to this directory? (Y/N)
N
Please set the new installation directory/path:
/opt/dynatrace-6.2
The product will be installed to /opt/dynatrace-6.2. Do you want to install to this directory? (Y/N)
Y
Installation directory '/opt/dynatrace-6.2' already exists.
Do you want to continue (Y/N)?
Y
Extracting: dynatrace-6.2/agent/downloads/
Extracting: dynatrace-6.2/agent/conf/
Extracting: dynatrace-6.2/agent/lib/
Extracting: dynatrace-6.2/agent/conf/
Extracting: dynatrace-6.2/agent/lib64/
Extracting: dynatrace-6.2/log/
Extracting: dynatrace-6.2/agent/conf/dthostagent.ini
Extracting: dynatrace-6.2/agent/lib/dthostagent
Extracting: dynatrace-6.2/agent/lib/libdtagent.lel
Extracting: dynatrace-6.2/agent/lib/libdtagent.so
Extracting: dynatrace-6.2/agent/lib/libdtagentcore.so
Extracting: dynatrace-6.2/agent/lib/libdtwsmbagent.so
Extracting: dynatrace-6.2/agent/conf/dthostagent.ini
Extracting: dynatrace-6.2/agent/lib64/dthostagent
Extracting: dynatrace-6.2/agent/lib64/dtzagent
Extracting: dynatrace-6.2/agent/lib64/libdtagent.lel
Extracting: dynatrace-6.2/agent/lib64/libdtagent.so
Extracting: dynatrace-6.2/agent/lib64/libdtagentcore.so
Extracting: dynatrace-6.2/agent/lib64/libdtwsmbagent.so
Extracting: dynatrace-6.2/init.d/
Extracting: dynatrace-6.2/init.d/dynaTraceHostagent
Extracting: dynatrace-6.2/init.d/dynaTraceWebServerAgent
Extracting: dynatrace-6.2/init.d/dynaTracezRemoteAgent
Making file '/opt/dynatrace-6.2/init.d/dynaTracezRemoteAgent' executable...
Making file '/opt/dynatrace-6.2/init.d/dynaTraceHostagent' executable...
Making file '/opt/dynatrace-6.2/init.d/dynaTraceWebServerAgent' executable...
Making file '/opt/dynatrace-6.2/agent/lib/dthostagent' executable...
Making file '/opt/dynatrace-6.2/agent/lib64/dthostagent' executable...
Making file '/opt/dynatrace-6.2/agent/lib64/dtzagent' executable...
Set read and write permissions on file '/opt/dynatrace-6.2/agent/lib' ...
Set read and write permissions on file '/opt/dynatrace-6.2/agent/lib64' ...
Set read and write permissions on file '/opt/dynatrace-6.2/agent/downloads' ...
Set read and write permissions on file '/opt/dynatrace-6.2/log' ...
Set read and write permissions on file '/opt/dynatrace-6.2/agent/conf' ...
Set read and write permissions on file '/opt/dynatrace-6.2/agent/conf/dthostagent.ini' ...
Installation finished successfully in 0s
接下來就至
/opt
下去執行 dynatrace-wsagent-6.2.0.1239-linux-x64.sh
,這是由 dynatrace-wsagent-6.2.0.1239-linux-x64.tar
所解壓出來,執行它主要目的是要產生設定檔
執行前的目錄結構
dynatrace-6.2
├── agent
│ ├── conf
│ │ └── dthostagent.ini
│ ├── downloads
│ ├── lib
│ │ ├── dthostagent
│ │ ├── libdtagentcore.so
│ │ ├── libdtagent.lel
│ │ ├── libdtagent.so
│ │ └── libdtwsmbagent.so
│ └── lib64
│ ├── dthostagent
│ ├── dtzagent
│ ├── libdtagentcore.so
│ ├── libdtagent.lel
│ ├── libdtagent.so
│ └── libdtwsmbagent.so
├── init.d
│ ├── dynaTraceHostagent
│ ├── dynaTraceWebServerAgent
│ └── dynaTracezRemoteAgent
└── log
$ cd /opt
$ sudo ./dynatrace-wsagent-6.2.0.1239-linux-x64.sh
dynatrace-6.2
├── agent
│ ├── conf
│ │ ├── dthostagent.ini
│ │ ├── dtnginx_offsets.json
│ │ ├── dtwsagent.ini
│ │ ├── dtwsagent.ini.template
│ │ └── dynaTraceWebServerSharedMemory
│ ├── downloads
│ ├── lib
│ │ ├── dthostagent
│ │ ├── libdtagentcore.so
│ │ ├── libdtagent.lel
│ │ ├── libdtagent.so
│ │ └── libdtwsmbagent.so
│ └── lib64
│ ├── dthostagent
│ ├── dtwsagent
│ ├── dtzagent
│ ├── libdtagentcore.so
│ ├── libdtagent.lel
│ ├── libdtagent.so
│ ├── libdtapacheagent20bo.so
│ ├── libdtapacheagent20lo.so
│ ├── libdtapacheagent22bo.so
│ ├── libdtapacheagent22lo.so
│ ├── libdtapacheagent24bo.so
│ ├── libdtapacheagent24lo.so
│ ├── libdtnginxagent.so
│ ├── libdtphpagent52.so
│ ├── libdtphpagent52_ts.so
│ ├── libdtphpagent53.so
│ ├── libdtphpagent53_ts.so
│ ├── libdtphpagent54.so
│ ├── libdtphpagent54_ts.so
│ ├── libdtphpagent55.so
│ ├── libdtphpagent55_ts.so
│ ├── libdtphpagent56.so
│ ├── libdtphpagent56_ts.so
│ ├── libdtwsagent.so
│ └── libdtwsmbagent.so
├── init.d
│ ├── dynaTraceHostagent
│ ├── dynaTraceWebServerAgent
│ └── dynaTracezRemoteAgent
└── log
執行後的目錄結構,明顯可以看出除了設定檔之外,還把必要使用的libary也都給放到相對應的路徑底下了,由於我要測試的PHP部份,所以接下來就是要把dynatarce的libary給放到PHP的路徑底下,先確認
dynatrace-6.2/agent/lib64/libdtagent.so
是否存在,再來就是把它放到 /etc/php.d
下,命名為dynatrace.ini
echo "extension=/opt/dynatrace-6.2/agent/lib64/libdtagent.so" > /etc/php.d/dynatrace.ini
再來就是修改設定檔,讓dynatrace agent 可以把資料送到 dynatrace colletor
sed 's/Name dtwsagent/Name New-name_TST/' -i /opt/dynatrace-6.2/agent/conf/dtwsagent.ini
sed 's/Server localhost/Server Dynatrace-collector-IP:9998/' -i /opt/dynatrace-6.2/agent/conf/dtwsagent.ini
確認
/opt/dynatrace-6.2/init.d/dynaTraceWebServerAgent
這支程式裡的 DT_HOME
這個參數的路徑是不是你所安裝的路徑(/opt/dynatrace-6.2),如果不是,請記得修改
重開前需要確認 PHP 要有讀取的權限,因此需要修改
/opt/dynatrace-6.2
的權限chown -R www-data:www-data /opt/dynatrace-6.2
最後就先啟用 dynatrace,再把 PHP 重開
/opt/dynatrace-6.2/init.d/dynaTraceWebServerAgent start
/etc/init.d/php-fpm restart
Stopping php-fpm: [ OK ]
Starting php-fpm: 2016-08-07 16:25:57 [d8f2e88d] info [native] Loading collector peer list from /opt/dynatrace-6.2/agent/conf/collectorlist.New-name_TST
2016-08-07 16:25:57 [d8f2e88d] info [native] 0 entries loaded
[ OK ]
接下來就是要用 Dynatrace Client 去確認是否有成功
沒有留言:
張貼留言