zipkindb 监控工程

This commit is contained in:
liuweijw
2018-05-31 21:34:06 +08:00
parent 169af7d00a
commit 8f898e9a80
11 changed files with 325 additions and 17 deletions

View File

@@ -81,23 +81,12 @@
![image](doc/pic/cloud-framework.png)
# 常见问题
# 常见问题
- 找不到带Q开头的类
- lombok 安装
* 下载lombok.jar包 https://projectlombok.org/download.html
* 在eclipse.ini 配置文件最后添加:-javaagent:F:\xxx\lombok.jar 注F:\xxx 为lombok.jar 放置的目录地址
* 重启eclipse
- 项目导入工程遇到 maven 插件问题
~~~
You need to run build with JDK or have tools.jar on the classpath. If this occurs during eclipse build make sure you run eclipse under JDK as well (com.mysema.maven:apt-maven-plugin:1.1.3:process:default:generate-sources
解决在eclipse.ini 配置文件添加
-vm
{path_to_jdk}\jdk{your_version}\bin\javaw.exe
~~~
- idea 安装
* 查看地址[guide](http://blog.csdn.net/zhglance/article/details/54931430)
* idea 导入工程方法建议参考[guide](http://blog.csdn.net/sinat_36246371/article/details/52914448)
- 上述问题解决[guide](https://github.com/liuweijw/fw-cloud-framework/wiki/09-%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98%E8%A7%A3%E5%86%B3)
# 服务相关图片
- eureka服务注册 [点击访问用户名admin 密码liuweijw](http://47.106.144.24:1001/)
@@ -115,3 +104,8 @@ You need to run build with JDK or have tools.jar on the classpath. If this occur
![image](doc/pic/1005.png)
![image](doc/pic/1006.png)
![image](doc/pic/1007.png)
- zipkin db服务状态监控 [点击访问](http://47.106.144.24:1011/)
![image](doc/pic/1008.png)
![image](doc/pic/1009.png)

BIN
doc/pic/1008.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

BIN
doc/pic/1009.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

View File

@@ -0,0 +1 @@
/target/

View File

@@ -0,0 +1,76 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>fw-cloud-monitor-zipkin-db</artifactId>
<packaging>jar</packaging>
<name>fw-cloud-monitor-zipkin-db</name>
<description>系统zipkin database监控</description>
<parent>
<groupId>com.github.liuweijw</groupId>
<artifactId>fw-cloud-monitor</artifactId>
<version>${fw.monitor.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.github.liuweijw</groupId>
<artifactId>fw-cloud-core-commons</artifactId>
<version>${fw.core.version}</version>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
<!-- http://www.itmuch.com/spring-cloud/edgware-new-sleuth-zipkin-mq/ -->
<!-- https://mvnrepository.com/artifact/io.zipkin.java/zipkin-autoconfigure-collector-rabbitmq -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-collector-rabbitmq</artifactId>
<version>${zipkin-autoconfigure.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.zipkin.java/zipkin-autoconfigure-storage-mysql -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--数据库连接池-->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,76 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>fw-cloud-monitor-zipkin-db</artifactId>
<packaging>jar</packaging>
<name>fw-cloud-monitor-zipkin-db</name>
<description>系统zipkin database监控</description>
<parent>
<groupId>com.github.liuweijw</groupId>
<artifactId>fw-cloud-monitor</artifactId>
<version>${fw.monitor.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.github.liuweijw</groupId>
<artifactId>fw-cloud-core-commons</artifactId>
<version>${fw.core.version}</version>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
<!-- http://www.itmuch.com/spring-cloud/edgware-new-sleuth-zipkin-mq/ -->
<!-- https://mvnrepository.com/artifact/io.zipkin.java/zipkin-autoconfigure-collector-rabbitmq -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-collector-rabbitmq</artifactId>
<version>${zipkin-autoconfigure.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.zipkin.java/zipkin-autoconfigure-storage-mysql -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--数据库连接池-->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<finalName>${project.name}</finalName>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,74 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>fw-cloud-monitor-zipkin-db</artifactId>
<packaging>war</packaging>
<name>fw-cloud-monitor-zipkin-db</name>
<description>系统zipkin database监控</description>
<parent>
<groupId>com.github.liuweijw</groupId>
<artifactId>fw-cloud-monitor</artifactId>
<version>${fw.monitor.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.github.liuweijw</groupId>
<artifactId>fw-cloud-core-commons</artifactId>
<version>${fw.core.version}</version>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-server</artifactId>
</dependency>
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-ui</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/io.zipkin.java/zipkin-autoconfigure-collector-rabbitmq -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-collector-rabbitmq</artifactId>
<version>${zipkin-autoconfigure.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.zipkin.java/zipkin-autoconfigure-storage-mysql -->
<dependency>
<groupId>io.zipkin.java</groupId>
<artifactId>zipkin-autoconfigure-storage-mysql</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
</exclusion>
</exclusions>
</dependency>
<!--数据库连接池-->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
</dependency>
</dependencies>
<build>
<!-- Tomcat ROOT 方式部署 -->
<finalName>ZIPKINDB</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,25 @@
package com.github.liuweijw.monitor.zipkindb;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import zipkin.server.EnableZipkinServer;
@EnableDiscoveryClient
@SpringBootApplication
@EnableZipkinServer
public class FwMonitorZipkenDbApplication extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(FwMonitorZipkenDbApplication.class);
}
public static void main(String[] args) {
SpringApplication.run(FwMonitorZipkenDbApplication.class, args);
}
}

View File

@@ -0,0 +1,43 @@
spring:
application:
name: monitor-zipkindb-server
profiles:
active: dev
cloud:
config:
fail-fast: true
discovery:
service-id: system-config-server
enabled: true
profile: ${spring.profiles.active}
label: ${spring.profiles.active}
---
spring:
profiles: dev
eureka:
instance:
prefer-ip-address: true
lease-renewal-interval-in-seconds: 5
lease-expiration-duration-in-seconds: 10
client:
registry-fetch-interval-seconds: 10 # 默认为30秒 表示eureka client间隔多久去拉取服务注册信息默认为30秒对于api-gateway如果要迅速获取服务注册状态可以缩小该值比如5秒
serviceUrl:
defaultZone: http://admin:liuweijw@localhost:1001/eureka
---
spring:
profiles: untest
eureka:
instance:
prefer-ip-address: true
client:
serviceUrl:
defaultZone: http://admin:liuweijw@47.106.144.24:1001/eureka
---
spring:
profiles: prod
eureka:
instance:
prefer-ip-address: true
client:
serviceUrl:
defaultZone: http://admin:liuweijw@localhost:1001/eureka

View File

@@ -22,8 +22,8 @@
<modules>
<!-- monitor 系统监控模块 -->
<module>fw-cloud-monitor-monitor</module>
<!-- zipkin database 数据库监控
<module>fw-cloud-monitor-zipkin-db</module>-->
<!-- zipkin database 数据库监控-->
<module>fw-cloud-monitor-zipkin-db</module>
<!-- zipkin elk 分布式链路追踪监控
<module>fw-cloud-monitor-zipkin-elk</module> -->
</modules>

View File

@@ -0,0 +1,19 @@
server:
port: 1011
spring:
datasource:
driver-class-name: com.mysql.jdbc.Driver
username: ENC(rC/X/8UBBH2bn9Tgfuu7aw==)
password: ENC(IVTzs5LDfVEsblAFWFgA9w==)
url: jdbc:mysql://localhost:3306/fw-cloud?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false
zipkin:
collector:
rabbitmq:
addresses: 127.0.0.1:5672
password: guest
username: guest
queue: zipkin
storage:
type: mysql