5、pinpoint接入
1、开启性能监控
应用管理详情页面-->【属性】编辑,勾选开启用性能监控
2.java命令行引用pinpoint和相关变量
java JAVA_OPTS -javaagent:/usr/local/pinpoint-agent/pinpoint-bootstrap-1.7.2.jar -Dpinpoint.agentId=dcs-repair-{HOSTNAME:0-10} -Dpinpoint.applicationName=dcs-repair -Dprofiler.collector.ip={PINPOINT_COLLECTOR_IP} -jar -Deureka.client.serviceUrl.defaultZone={EUREKA_URL} -Dspring.cloud.config.profile=${PROFILE} dcscloud.repair-0.0.1-SNAPSHOT.jar
3.增加pinpoint环境变量(日志级别和pinpoint收集端)
4.配置完成后保存重启
二、批量接入
注意:处理前请先备份app_env表
1.删除已经存在的pinpoint环境变量配置
DELETE * from app_env e where e.`key` like '%PINPOINT%';
DELETE * FROM app_env e where e.`key` like '%CONTEXT_NAME%';
2.批量为每个应用插入CONTEXT_NAME,PINPOINT_ENABLED,PINPOINT_COLLECTOR_IP三个环境变量
INSERT INTO app_env (app_id, provider_id, `key`, `value`, dr, ts, create_time, update_time)
SELECT DISTINCT a.id, 'c87e2267-1001-4c70-bb2a-ab41f3b81aa3', 'PINPOINT_ENABLED', 'true', 0, DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'), DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'), DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s')
FROM app a WHERE a.dr = 0;
INSERT INTO app_env (app_id, provider_id, `key`, `value`, dr, ts, create_time, update_time)
SELECT DISTINCT a.id, 'c87e2267-1001-4c70-bb2a-ab41f3b81aa3', 'PINPOINT_COLLECTOR_IP', '替换成pinpoint-collector的ip', 0, DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'), DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'), DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s')
FROM app a WHERE a.dr = 0;
INSERT INTO app_env (app_id, provider_id, `key`, `value`, dr, ts, create_time, update_time)
SELECT a.id, 'c87e2267-1001-4c70-bb2a-ab41f3b81aa3', 'CONTEXT_NAME', u.app_code, 0, DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'), DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s'), DATE_FORMAT(NOW(),'%Y-%m-%d %H:%i:%s')
FROM app a join assembly_line_main u on u.assembly_line_main_id = left(a.upload_app_id, LOCATE('@@', a.upload_app_id)-1);
3、在应用详情--->属性--->【保存并重启】容器
5.1pinpoint接入tomcat
1、开启性能监控
应用管理详情页面-->【属性】编辑,勾选开启用性能监控
3.增加pinpoint环境变量(日志级别和pinpoint收集端)
| key | value |
|:--- |
| PINPOINT_COLLECTOR_IP | ip |
| PINPOINT_COLLECTOR_TCP_PORT | 9994 |
| JAVA_OPTS | -javaagent:/usr/local/pinpoint-agent/pinpoint-bootstrap-1.7.4.jar -Dpinpoint.agentId=iuap5-test2048 -Dpinpoint.applicationName=iuap5-test2048 -Dprofiler.collector.ip=${PINPOINT_COLLECTOR_IP} |
| PINPOINT_LOG_LEVEL | DEBUG |
pinpoint采集端:-javaagent:/usr/local/pinpoint-agent/pinpoint-bootstrap-1.8.1.jar
pinpoint.agentId: -Dpinpoint.agentId=APM-104
pinpoint监控web显示应用名称: -Dpinpoint.applicationName=tomcat8
4.配置完成后保存重启