Elastic添加APM监控
- 1. 下载安装
- 2. 配置
- 3. 启动设置
- 4. 查看监控
APM (Application Performance Management) 即应用性能管理,属于IT运维管理(ITOM)范畴。主要是针对企业 关键业务的IT应用性能和用户体验的监测、优化,提高企业IT应用的可靠性和质量,保证用户得到良好的服务,降低IT总拥有成本(TCO)。
参考链接:https://www.jianshu.com/p/4b756ee173fa
1. 下载安装
# 下载
curl -L -O https://artifacts.elastic.co/downloads/apm-server/apm-server-7.11.1-x86_64.rpm
# 安装
sudo rpm -vi apm-server-7.11.1-x86_64.rpm
2. 配置
修改配置文件: /etc/apm-server/apm-server.yml
apm-server
host"192.168.50.136:8200"
output.elasticsearch
hosts"192.168.50.136:9200"
username"elastic"
password"123456"
3. 启动设置
# 启动apm-server
service apm-server start
# 重启apm-server
service apm-server restart
# 停止apm-server
service apm-server stop
需要下载代理:https://search.maven.org/search?q=a:elastic-apm-agent 下载之后需要放到指定文件夹下
这里我放到/home/jack/elastic-apm-agent-1.21.0.jar
下面
启动脚本:
service_name
: 服务名称
server_urls
: 配置服务
environment
: 环境 production 为正式环境
application_packages
: 基础包
nohup /usr/local/jdk1.8.0_281/bin/java -javaagent:/home/jack/elastic-apm-agent-1.21.0.jar \
-Delastic.apm.service_name=forestUserProvider \
-Delastic.apm.server_urls=http://192.168.50.136:8200 \
-Delastic.apm.secret_token= \
-Delastic.apm.environment=production \
-Delastic.apm.application_packages=com.fh \
-jar /opt/data/jardata/xxx.jar --spring.profiles.active=prod --server.port=8080 2>&1 &
4. 查看监控
和第一步一样点击APM
然后点击对应名称
找到对应事务,然后点击
可以查看完整追溯信息
这里有sql查询和http请求链路
点击对应的sql语句,就可以查看到对应的数据库语句
错误也有专门的记录,点击查看错误即可