ELK-APM
APM-server部署配置
參考:
https://www.elastic.co/guide/en/apm/server/7.2/installing.html
https://www.elastic.co/guide/en/apm/index.html
安裝
yum install -y apm-server
service apm-server start #啟動(dòng)
apm-server配置文件(apm-server.yml)內(nèi)容有很多芥驳,具體使用根據(jù)需要看官方文檔配置顾瞻,下面是主要的配置,綁定host和端口顿痪,發(fā)送到elasticsearch集群。
apm-server:
host: "172.16.15.53:8200"
rum:
enabled: true
output.elasticsearch:
hosts: ["172.16.15.53:9200","172.16.15.48:9200"]
username: "elastic"
password: "RRCOfh9UudUIVZ4i954E"
APM-agent
參考:https://www.elastic.co/guide/en/apm/agent/index.html
server配置好,就需要在客戶(hù)端配置了,根據(jù)官方文檔可以看到支持如下:
APM-agent支持
在kibana中apm中也可以看到支持的類(lèi)型扣草。有部分是有侵入的需要在代碼中配置。Java支持非侵入式的javaagent模式配置颜屠。這里需要下載jar包辰妙。
kibana上的apm
Tomcat無(wú)侵入
在tomcat中使用方式在/home/app/tomcat/bin/ catalina.sh:
JAVA_OPTS="-javaagent:${CATALINA_HOME}/lib/elastic-apm-agent-1.7.0.jar \ #注意jar包放置的位置,特別注意如果使用CATALINA_HOME,需要在定義后加入汽纤。
-Delastic.apm.service_name=test-apm \#監(jiān)控的名字根據(jù)需要填寫(xiě)上岗,修改后會(huì)出現(xiàn)新的監(jiān)控名字
-Delastic.apm.server_url=http://172.16.15.53:8200 \ #server-apm地址
-Delastic.apm.application_packages=org.example,org.another.example"
如果是其他java程序(參考):
java -javaagent:/path/to/elastic-apm-agent-<version>.jar \
-Delastic.apm.service_name=my-application \
-Delastic.apm.server_url=http://localhost:8200 \
-Delastic.apm.secret_token= \
-Delastic.apm.application_packages=org.example \
-jar my-application.jar
測(cè)試tomcat監(jiān)控如下所示福荸,可以看到各個(gè)模塊消耗的時(shí)間和錯(cuò)誤蕴坪,以及指標(biāo)
tomcat的APM測(cè)試
apm測(cè)試