spring boot admin 监控

This commit is contained in:
wangiegie@gmail.com 2017-12-26 12:58:28 +08:00
parent e80361e61f
commit 0f71c48715
4 changed files with 119 additions and 0 deletions

59
pig-monitor/pom.xml Normal file
View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>
<groupId>com.github.pig</groupId>
<artifactId>pig-monitor</artifactId>
<version>${pig.version}</version>
<packaging>jar</packaging>
<name>pig-monitor</name>
<description>监控模块</description>
<parent>
<groupId>com.github</groupId>
<artifactId>pig</artifactId>
<version>${pig.version}</version>
</parent>
<dependencies>
<dependency>
<groupId>com.github.pig</groupId>
<artifactId>pig-common</artifactId>
<version>${pig.version}</version>
</dependency>
<!--admin-->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.5</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.5</version>
</dependency>
<!--<dependency>-->
<!--<groupId>org.springframework.cloud</groupId>-->
<!--<artifactId>spring-cloud-starter-turbine-stream</artifactId>-->
<!--</dependency>-->
<!--<dependency>-->
<!--<groupId>org.springframework.cloud</groupId>-->
<!--<artifactId>spring-cloud-starter-stream-rabbit</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,21 @@
package com.github.pig.monitor;
import de.codecentric.boot.admin.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
/**
* @author lengleng
* @date 2017-12-26 10:15:30
* 监控模块
*/
@EnableAdminServer
@EnableDiscoveryClient
@SpringBootApplication
public class PigMonitorApplication {
public static void main(String[] args) {
SpringApplication.run(PigMonitorApplication.class, args);
}
}

View File

@ -0,0 +1,33 @@
spring:
application:
name: pig-monitor
profiles:
active: dev
cloud:
config:
fail-fast: true
discovery:
service-id: pig-config-server
enabled: true
profile: ${spring.profiles.active}
label: master
---
spring:
profiles: dev
eureka:
instance:
prefer-ip-address: true
client:
serviceUrl:
defaultZone: http://pig:gip6666@localhost:1025/eureka
---
spring:
profiles: prd
eureka:
instance:
prefer-ip-address: true
client:
serviceUrl:
defaultZone: http://pig:gip6666@pig-eureka:1025/eureka

View File

@ -35,6 +35,11 @@
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-config</artifactId>
</dependency>
<!--监控-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!--测试依赖-->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -47,6 +52,7 @@
<module>pig-common</module>
<module>pig-eureka</module>
<module>pig-config</module>
<module>pig-monitor</module>
<module>pig-gateway</module>
<module>pig-auth-service</module>
<module>pig-admin-service</module>