Open bingoogolapple opened 6 years ago
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://mysqlhost:3306/pinpoint?characterEncoding=UTF-8
jdbc.username=admin
jdbc.password=admin
#batch enable config
batch.enable=true
#batch server ip to execute batch
batch.server.ip=127.0.0.1
mail.smtpserver=smtp.xxxx.com
mail.smtpserver.port=25
mail.from=username@xxxx.com
mail.password=your_pwd
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.0</version>
</dependency>
package com.navercorp.pinpoint.web.alarm;
import com.navercorp.pinpoint.common.util.PropertyUtils;
import com.navercorp.pinpoint.web.alarm.checker.AlarmChecker;
import com.navercorp.pinpoint.web.service.UserGroupService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSenderImpl;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.List;
import java.util.Properties;
/**
* 作者:王浩 邮件:bingoogolapple@gmail.com
* 创建时间:2017/8/4 下午1:51
* 描述:报警消息发送器
*/
@Component
public class AlarmMessageSenderImpl implements AlarmMessageSender {
private static final Logger LOGGER = LoggerFactory.getLogger(AlarmMessageSenderImpl.class);
@Autowired
private UserGroupService userGroupService;
private JavaMailSenderImpl mailSender;
public AlarmMessageSenderImpl() {
try {
Properties properties = PropertyUtils.loadPropertyFromClassPath("mail.properties");
mailSender = new JavaMailSenderImpl();
mailSender.setHost(properties.getProperty("mail.smtpserver"));
mailSender.setPort(Integer.parseInt(properties.getProperty("mail.smtpserver.port")));
mailSender.setUsername(properties.getProperty("mail.from"));
mailSender.setPassword(properties.getProperty("mail.password"));
mailSender.setJavaMailProperties(getMailProperties());
} catch (IOException e) {
mailSender = null;
LOGGER.error("初始化邮件发送者失败", e);
e.printStackTrace();
}
}
private Properties getMailProperties() {
Properties properties = new Properties();
properties.setProperty("mail.transport.protocol", "smtp");
properties.setProperty("mail.smtp.auth", "true");
properties.setProperty("mail.smtp.starttls.enable", "true");
properties.setProperty("mail.smtp.starttls.required", "true");
properties.setProperty("mail.debug", "false");
return properties;
}
/**
* 发送邮件
*
* @param to 邮件接收者
* @param text 邮件内容
*/
private void sendEmail(String to, String text) {
try {
SimpleMailMessage message = new SimpleMailMessage();
message.setTo(to);
message.setSubject("pinpoint 报警邮件");
message.setText(text);
mailSender.send(message);
} catch (Exception e) {
LOGGER.error("发送邮件失败", e);
}
}
@Override
public void sendEmail(AlarmChecker checker, int sequenceCount) {
LOGGER.error("发送邮件");
List<String> receivers = userGroupService.selectEmailOfMember(checker.getuserGroupId());
if (mailSender == null || receivers.size() == 0) {
return;
}
for (String emailId : receivers) {
sendEmail(emailId, checker.getEmailMessage());
}
}
@Override
public void sendSms(AlarmChecker checker, int sequenceCount) {
}
}
mvn install -Prelease -Dmaven.test.skip=true
更多配置信息请参考 官方文档
修改 com.navercorp.pinpoint.web.config.WebSocketConfig
docker run -it -p 22:22 -p 81:80 --name pp bingoogolapple/bga-centos-java:v1
echo "172.17.0.4 mysqlhost" >> /etc/hosts
service sshd start
先 ctrl + p
然后 ctrl + q
scp -r software root@localhost:~
docker run -d -p 3306:3306 --name pp_mysql -e MYSQL_ROOT_PASSWORD=admin -e MYSQL_USER=admin -e MYSQL_PASSWORD=admin -e MYSQL_DATABASE=pinpoint mysql:latest --character-set-server=utf8 --collation-server=utf8_general_ci --lower-case-table-names=1
127.0.0.1 hbase.bga.cn
127.0.0.1 ppw.bga.cn
127.0.0.1 www.bga.cn
ssh root@localhost
upstream server_hbase {
server 127.0.0.1:16010;
}
server {
listen 80;
server_name hbase.bga.cn;
location / {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://server_hbase;
proxy_read_timeout 90;
}
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream server_ppw {
server 127.0.0.1:28080;
}
server {
listen 80;
server_name ppw.bga.cn;
location / {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://server_ppw;
proxy_read_timeout 90;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
upstream server_www {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name www.bga.cn;
location / {
proxy_set_header Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://server_www;
proxy_read_timeout 90;
}
}
tar -zxvf hbase-1.2.6-bin.tar.gz -C /opt
export HBASE_HOME=/opt/hbase-1.2.6
export PATH=$HBASE_HOME/bin:$PATH
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///data/hbase</value>
</property>
</configuration>
start-hbase.sh
hbase shell hbase-create.hbase
hbase shell
status 'detailed'
nginx
cd /opt
cp -r apache-tomcat-8.5.14 tomcat-pp-collector
cd /opt/tomcat-pp-collector/conf
sed -i 's/port="8005"/port="18005"/g' server.xml
sed -i 's/port="8080"/port="18080"/g' server.xml
sed -i 's/port="8443"/port="18443"/g' server.xml
sed -i 's/port="8009"/port="18009"/g' server.xml
sed -i 's/redirectPort="8443"/redirectPort="18443"/g' server.xml
sed -i "s/localhost/`ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | awk -F: '{print $2}'`/g" server.xml
rm -rf /opt/tomcat-pp-collector/webapps/*
unzip ~/software/pinpoint-collector-1.6.2.war -d /opt/tomcat-pp-collector/webapps/ROOT
/opt/tomcat-pp-collector/bin/startup.sh
tail -f /opt/tomcat-pp-collector/logs/catalina.out
cd /opt
cp -r apache-tomcat-8.5.14 tomcat-pp-web
cd /opt/tomcat-pp-web/conf
sed -i 's/port="8005"/port="28005"/g' server.xml
sed -i 's/port="8080"/port="28080"/g' server.xml
sed -i 's/port="8443"/port="28443"/g' server.xml
sed -i 's/port="8009"/port="28009"/g' server.xml
sed -i 's/redirectPort="8443"/redirectPort="28443"/g' server.xml
sed -i "s/localhost/`ifconfig eth0 | grep 'inet addr' | awk '{print $2}' | awk -F: '{print $2}'`/g" server.xml
rm -rf /opt/tomcat-pp-web/webapps/*
unzip ~/software/pinpoint-web-1.6.2.war -d /opt/tomcat-pp-web/webapps/ROOT
/opt/tomcat-pp-web/bin/startup.sh
tail -f /opt/tomcat-pp-web/logs/catalina.out
cd /opt/tomcat-web
tar -zxvf ~/software/pinpoint-agent-1.6.2.tar.gz
mkdir /opt/pinpoint-agent-1.6.2
tar -zxvf ~/software/pinpoint-agent-1.6.2.tar.gz -C /opt/pinpoint-agent-1.6.2
cd /opt
cp -r apache-tomcat-8.5.14 tomcat-web
rm -rf /opt/tomcat-web/webapps/*
unzip ~/software/backend-1.0.0.war -d /opt/tomcat-web/webapps/ROOT
CATALINA_OPTS="$CATALINA_OPTS -javaagent:/opt/pinpoint-agent-1.6.2/pinpoint-bootstrap-1.6.2.jar"
CATALINA_OPTS="$CATALINA_OPTS -Dpinpoint.agentId=pp_test8080"
CATALINA_OPTS="$CATALINA_OPTS -Dpinpoint.applicationName=test8080"
/opt/tomcat-web/bin/startup.sh
tail -f /opt/tomcat-web/logs/catalina.out
可以通过 http://www.bga.cn:81 访问
docker start pp
docker start pp_mysql
docker attach pp
echo "172.17.0.4 mysqlhost" >> /etc/hosts
service sshd start
nginx
start-hbase.sh
/opt/tomcat-pp-collector/bin/startup.sh
/opt/tomcat-pp-web/bin/startup.sh
/opt/tomcat-web/bin/startup.sh
虽然pinpoint说支持springboot,但是实际情况却无法捕获数据。楼主遇到过吗
@wyfaq 你是无法抓取 http 请求的数据,还是无法抓取数据库操作的数据,还是抓取不到两台服务器之前相互调用的数据?
所有的都抓不到,包括http请求以及连接数据库的请求。我已经把采样率设置为100%了。
pinpoint.config配置如下:
profiler.collector.ip=192.168.22.139 profiler.collector.span.ip=${profiler.collector.ip} profiler.collector.span.port=9996 profiler.collector.stat.ip=${profiler.collector.ip} profiler.collector.stat.port=9995 profiler.collector.tcp.ip=${profiler.collector.ip} profiler.collector.tcp.port=9994 profiler.enable=true profiler.interceptorregistry.size=8192 profiler.jvm.collect.interval=1000 profiler.jvm.collect.detailed.metrics=true profiler.sampling.enable=true profiler.sampling.rate=1 profiler.io.buffering.enable=true profiler.io.buffering.buffersize=20 profiler.spandatasender.write.queue.size=5120 profiler.spandatasender.chunk.size=16384 profiler.spandatasender.socket.type=OIO profiler.statdatasender.write.queue.size=5120 profiler.statdatasender.chunk.size=16384 profiler.statdatasender.socket.type=OIO profiler.agentInfo.send.retry.interval=300000 profiler.tcpdatasender.command.accept.enable=true profiler.tcpdatasender.command.activethread.enable=true profiler.tcpdatasender.command.activethread.count.enable=true profiler.tcpdatasender.command.activethread.threaddump.enable=true profiler.tcpdatasender.command.activethread.threadlightdump.enable=true profiler.pinpoint.activethread=true profiler.pinpoint.datasource=true profiler.callstack.max.depth=64 profiler.interceptor.exception.propagate=false profiler.instrument.engine=ASM bytecode.dump.enable=false bytecode.dump.classlist= bytecode.dump.bytecode=false bytecode.dump.verify=false bytecode.dump.asm=false profiler.applicationservertype=SPRING_BOOT profiler.type.detect.order= profiler.plugin.disable= profiler.include= profiler.entrypoint= profiler.tomcat.enable=true profiler.tomcat.bootstrap.main=org.apache.catalina.startup.Bootstrap profiler.tomcat.conditional.transform=false profiler.tomcat.hidepinpointheader=true profiler.tomcat.excludeurl=/aa/test.html, /bb/exclude.html profiler.tomcat.tracerequestparam=true profiler.tomcat.realipheader=X-Forwarded-For profiler.jetty.enable=true profiler.jetty.bootstrap.main=org.eclipse.jetty.start.Main profiler.jetty.excludeurl= profiler.dubbo.enable=true profiler.dubbo.bootstrap.main=com.alibaba.dubbo.container.Main profiler.jboss.enable=true profiler.jboss.bootstrap.main=org.jboss.modules.Main profiler.jboss.conditional.transform=true profiler.jboss.hidepinpointheader=true profiler.jboss.excludeurl= profiler.jboss.tracerequestparam=true profiler.jboss.realipheader=X-Forwarded-For profiler.vertx.enable=false profiler.vertx.bootstrap.main=io.vertx.core.Starter profiler.vertx.handlers= profiler.vertx.http.server.enable=false profiler.vertx.http.server.tracerequestparam=true profiler.vertx.http.server.excludeurl= profiler.vertx.http.server.realipheader=X-Forwarded-For profiler.vertx.http.client.enable=false profiler.vertx.http.client.param=true profiler.vertx.http.client.cookie=true profiler.vertx.http.client.cookie.dumptype=ALWAYS profiler.vertx.http.client.cookie.sampling.rate=1 profiler.vertx.http.client.entity.statuscode=true profiler.springboot.enable=true profiler.springboot.bootstrap.main=org.springframework.boot.loader.JarLauncher, org.springframework.boot.loader.WarLauncher, org.springframework.boot.loader.PropertiesLauncher profiler.jdbc=true profiler.jdbc.sqlcachesize=1024 profiler.jdbc.tracesqlbindvalue=true profiler.jdbc.maxsqlbindvaluesize=1024 profiler.jdbc.mysql=true profiler.jdbc.mysql.setautocommit=true profiler.jdbc.mysql.commit=true profiler.jdbc.mysql.rollback=true profiler.jdbc.mariadb=true profiler.jdbc.mariadb.setautocommit=true profiler.jdbc.mariadb.commit=true profiler.jdbc.mariadb.rollback=true profiler.jdbc.jtds=true profiler.jdbc.jtds.setautocommit=true profiler.jdbc.jtds.commit=true profiler.jdbc.jtds.rollback=true profiler.jdbc.oracle=true profiler.jdbc.oracle.setautocommit=true profiler.jdbc.oracle.commit=true profiler.jdbc.oracle.rollback=true profiler.jdbc.cubrid=true profiler.jdbc.cubrid.setautocommit=true profiler.jdbc.cubrid.commit=true profiler.jdbc.cubrid.rollback=true profiler.jdbc.dbcp=true profiler.jdbc.dbcp.connectionclose=true profiler.jdbc.dbcp2=true profiler.jdbc.dbcp2.connectionclose=true profiler.jdbc.hikaricp=true profiler.jdbc.hikaricp.connectionclose=true profiler.cassandra=true profiler.jdbc.postgresql=true profiler.jdbc.postgresql.setautocommit=true profiler.jdbc.postgresql.commit=true profiler.jdbc.postgresql.rollback=true profiler.apache.httpclient3.param=true profiler.apache.httpclient3.cookie=true profiler.apache.httpclient3.cookie.dumptype=ALWAYS profiler.apache.httpclient3.cookie.sampling.rate=1 profiler.apache.httpclient3.entity=true profiler.apache.httpclient3.entity.dumptype=ALWAYS profiler.apache.httpclient3.entity.sampling.rate=1 profiler.apache.httpclient3.io=true profiler.apache.httpclient4.param=true profiler.apache.httpclient4.cookie=true profiler.apache.httpclient4.cookie.dumptype=ALWAYS profiler.apache.httpclient4.cookie.sampling.rate=1 profiler.apache.httpclient4.entity=true profiler.apache.httpclient4.entity.dumptype=ALWAYS profiler.apache.httpclient4.entity.sampling.rate=1 profiler.apache.httpclient4.entity.statuscode=true profiler.apache.httpclient4.io=true profiler.jdk.http.param=true profiler.ning.asynchttpclient=true profiler.ning.asynchttpclient.cookie=true profiler.ning.asynchttpclient.cookie.dumptype=ALWAYS profiler.ning.asynchttpclient.cookie.dumpsize=1024 profiler.ning.asynchttpclient.cookie.sampling.rate=1 profiler.ning.asynchttpclient.entity=true profiler.ning.asynchttpclient.entity.dumptype=ALWAYS profiler.ning.asynchttpclient.entity.dumpsize=1024 profiler.ning.asynchttpclient.entity.sampling.rate=1 profiler.ning.asynchttpclient.param=true profiler.ning.asynchttpclient.param.dumptype=ALWAYS profiler.ning.asynchttpclient.param.dumpsize=1024 profiler.ning.asynchttpclient.param.sampling.rate=1 profiler.arcus=true profiler.arcus.keytrace=true profiler.memcached=true profiler.memcached.keytrace=true profiler.thrift.client=true profiler.thrift.client.async=true profiler.thrift.processor=true profiler.thrift.processor.async=true profiler.thrift.service.args=true profiler.thrift.service.result=true profiler.orm.ibatis=true profiler.orm.mybatis=true profiler.spring.beans=true profiler.spring.beans.1.scope=component-scan profiler.spring.beans.1.base-packages= profiler.spring.beans.1.name.pattern= profiler.spring.beans.1.class.pattern= profiler.spring.beans.1.annotation=org.springframework.stereotype.Controller,org.springframework.stereotype.Service,org.springframework.stereotype.Repository profiler.spring.beans.mark.error=false profiler.log4j.logging.transactioninfo=false profiler.logback.logging.transactioninfo=false profiler.google.httpclient.async=true profiler.redis.pipeline profiler.redis=true profiler.redis.io=true profiler.okhttp.param=true profiler.okhttp.cookie=false profiler.okhttp.cookie.dumptype=EXCEPTION profiler.okhttp.cookie.sampling.rate=10 profiler.okhttp.async=true profiler.json.gson=false profiler.json.jackson=false profiler.json.jsonlib=false profiler.activemq.client.enable=true profiler.activemq.client.producer.enable=true profiler.activemq.client.consumer.enable=true profiler.activemq.client.destination.separator= profiler.activemq.client.destination.exclude= profiler.hystrix=true profiler.resin.enable=true profiler.resin.bootstrap.main= profiler.resin.tracerequestparam=true profiler.resin.excludeurl= profiler.resin.tracecookies=true profiler.resin.cookie.sampling.rate=10 profiler.resin.cookie.dumptype=ALWAYS
@wyfaq 你的问题解决了吗? 我也遇到这个问题了,trace信息采集不到,但是webUI可以找到对应的application
@oatiz 也许在pinpoint.config中配置profiler.springboot.bootstrap.main加上你的main class能解决问题
虽然pinpoint说支持springboot,但是实际情况却无法捕获数据。楼主遇到过吗
需要配置: profiler.rxjava=true profiler.hystrix=true profiler.resttemplate=true
本地编译打 release 包