SpringCloud十八、豪猪服务监控hystrixDashboard。

①什么是服务监控hystrixdashboard?

除了隔离依赖服务的调用以外,Hystrix还提供了准实时的调用监控(Hystrix Dashboard),Hystrix会持续地记录所有通过Hystrix发起的请求的执行信息,并以统计报表和图形的形式展示给用户,包括每秒执行多少请求多少成功,多少失败等。Netflix通过hystrix-metrics-event-stream项目实现了对以上指标的监控。Spring Cloud也提供了Hystrix Dashboard的整合,对监控内容转化成可视化界面

②新建工程microservicecloud-consumer-hystrix-dashboard。

SpringCloud十八、豪猪服务监控hystrixDashboard。_第1张图片

 

 

SpringCloud十八、豪猪服务监控hystrixDashboard。_第2张图片

 

 

 

SpringCloud十八、豪猪服务监控hystrixDashboard。_第3张图片

 

 

SpringCloud十八、豪猪服务监控hystrixDashboard。_第4张图片

 

 

 

③修改子模块工程microservicecloud-consumer-hystrix-dashboard的pom文件。

子模块工程microservicecloud-consumer-hystrix-dashboard的pom文件的修改内容是:

  
   
       org.springframework.cloud
       spring-cloud-starter-hystrix
   
   
       org.springframework.cloud
       spring-cloud-starter-hystrix-dashboard
    

 

 

 

子模块工程microservicecloud-consumer-hystrix-dashboard的pom文件的完整内容是:


	4.0.0
	
		com.lss.springcloud
		microservicecloud
		0.0.1-SNAPSHOT
	
	microservicecloud-consumer-hystrix-dashboard
	

		
		
			org.springframework.cloud
			spring-cloud-starter-hystrix
		
		
			org.springframework.cloud
			spring-cloud-starter-hystrix-dashboard
		



		
			com.lss.springcloud
			microservicecloud-api
			${project.version}
		
		
			org.springframework.boot
			spring-boot-starter-web
		
		
		
			org.springframework
			springloaded
		
		
			org.springframework.boot
			spring-boot-devtools
		

		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
		
		
			org.springframework.cloud
			spring-cloud-starter-ribbon
		
		
			org.springframework.cloud
			spring-cloud-starter-config
		








		
		
			com.amazonaws
			aws-java-sdk-core
			1.11.125
		

		
			com.amazonaws
			aws-java-sdk-autoscaling
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-bom
			1.11.125
			pom
		

		
			com.amazonaws
			aws-java-sdk-ec2
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-sts
			1.11.125
		

		
		
			org.jdom
			jdom2
			2.0.6
		









		
			org.apache.maven.shared
			maven-dependency-tree
			3.0.1
		
		
			org.vafer
			jdependency
			2.1.1
		
		
			org.ow2.asm
			asm
			7.0-beta
		
		
			org.ow2.asm
			asm-analysis
			7.0-beta
		
		
			org.ow2.asm
			asm-tree
			7.0-beta
		
		
			org.ow2.asm
			asm-commons
			7.0-beta
		
		
			org.ow2.asm
			asm-util
			7.0-beta
		







		
			org.springframework.boot
			spring-boot-loader-tools
			2.2.4.RELEASE
		
		
			org.springframework
			spring-core
			4.3.13.RELEASE
		
		
			org.apache.maven.shared
			maven-shared-utils
			3.2.1
		
		
			org.apache.commons
			commons-lang3
			3.9
		
		
			org.apache.maven
			maven-core
			3.3.9
		
		
			org.apache.maven
			maven-repository-metadata
			3.3.9
		
		
			org.eclipse.aether
			aether-util
			1.0.2.v20150114
		
		
			com.google.inject
			guice
			4.0
		
		
			org.codehaus.plexus
			plexus-archiver
			3.7.0
		
		
			org.ow2.asm
			asm-commons
			7.0
		
		
			com.google.guava
			guava
			19.0
		


		
			org.springframework.cloud
			spring-cloud-starter-feign
		

	
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				
					
						
							repackage
						
					
				
			
		
	








 

④修改子模块工程microservicecloud-consumer-hystrix-dashboard的yml文件。

SpringCloud十八、豪猪服务监控hystrixDashboard。_第5张图片

子模块工程microservicecloud-consumer-hystrix-dashboard的yml文件的完整内容是:

server:
  port: 9001

 

⑤修改主启动类改名+新注解@EnableHystrixDashboard。

SpringCloud十八、豪猪服务监控hystrixDashboard。_第6张图片

 

 

 

SpringCloud十八、豪猪服务监控hystrixDashboard。_第7张图片

 

 

SpringCloud十八、豪猪服务监控hystrixDashboard。_第8张图片

 

DeptConsumer_DashBoard_App.java的完整内容是:

package com.lss.springcloud;


import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.cloud.netflix.feign.EnableFeignClients;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
import org.springframework.context.annotation.ComponentScan;


@SpringBootApplication
//@EnableEurekaClient
@EnableFeignClients(basePackages= {"com.lss.springcloud"})
@ComponentScan("com.lss.springcloud")
@EnableHystrixDashboard
public class DeptConsumer_DashBoard_App {

	public static void main(String[] args) {
		SpringApplication.run(DeptConsumer_DashBoard_App.class, args);
	}

}

 

 

 

⑥所有Provider微服务提供类(8001/8002/8003)都需要监控依赖配置。

所有Provider微服务提供类(8001/8002/8003)都需要在pom文件新增:

   
   
     org.springframework.boot
     spring-boot-starter-actuator
   

 

 

microservicecloud-provider-dept-8001工程的pom完整内容是:


	4.0.0

	
		com.lss.springcloud
		microservicecloud
		0.0.1-SNAPSHOT
	

	microservicecloud-provider-dept-8001

	
		
			com.lss.springcloud
			microservicecloud-api
			${project.version}
		

		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
		
		
			org.springframework.cloud
			spring-cloud-starter-config
		

		
		
			org.springframework.boot
			spring-boot-starter-actuator
		



		
			junit
			junit
		
		
			mysql
			mysql-connector-java
		
		
			com.alibaba
			druid
		
		
			ch.qos.logback
			logback-core
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
		
		
			org.springframework.boot
			spring-boot-starter-jetty
		
		
			org.springframework.boot
			spring-boot-starter-web
		
		
			org.springframework.boot
			spring-boot-starter-test
		
		
		
			org.springframework
			springloaded
		
		
			org.springframework.boot
			spring-boot-devtools
		












		
		
			com.amazonaws
			aws-java-sdk-core
			1.11.125
		

		
			com.amazonaws
			aws-java-sdk-autoscaling
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-bom
			1.11.125
			pom
		

		
			com.amazonaws
			aws-java-sdk-ec2
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-sts
			1.11.125
		

		
		
			org.jdom
			jdom2
			2.0.6
		









		
			org.apache.maven.shared
			maven-dependency-tree
			3.0.1
		
		
			org.vafer
			jdependency
			2.1.1
		
		
			org.ow2.asm
			asm
			7.0-beta
		
		
			org.ow2.asm
			asm-analysis
			7.0-beta
		
		
			org.ow2.asm
			asm-tree
			7.0-beta
		
		
			org.ow2.asm
			asm-commons
			7.0-beta
		
		
			org.ow2.asm
			asm-util
			7.0-beta
		







		
			org.springframework.boot
			spring-boot-loader-tools
			2.2.4.RELEASE
		
		
			org.springframework
			spring-core
			4.3.13.RELEASE
		
		
			org.apache.maven.shared
			maven-shared-utils
			3.2.1
		
		
			org.apache.commons
			commons-lang3
			3.9
		
		
			org.apache.maven
			maven-core
			3.3.9
		
		
			org.apache.maven
			maven-repository-metadata
			3.3.9
		
		
			org.eclipse.aether
			aether-util
			1.0.2.v20150114
		
		
			com.google.inject
			guice
			4.0
		
		
			org.codehaus.plexus
			plexus-archiver
			3.7.0
		
		
			org.ow2.asm
			asm-commons
			7.0
		
		
			com.google.guava
			guava
			19.0
		


	
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				
					
						
							repackage
						
					
				
			
		
	






 

 

microservicecloud-provider-dept-8001_02工程的pom完整内容是:


	4.0.0
	
		com.lss.springcloud
		microservicecloud
		0.0.1-SNAPSHOT
	
	microservicecloud-provider-dept-8001_02

	
		
			com.lss.springcloud
			microservicecloud-api
			${project.version}
		

		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
		
		
			org.springframework.cloud
			spring-cloud-starter-config
		

		
		
			org.springframework.boot
			spring-boot-starter-actuator
		



		
			junit
			junit
		
		
			mysql
			mysql-connector-java
		
		
			com.alibaba
			druid
		
		
			ch.qos.logback
			logback-core
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
		
		
			org.springframework.boot
			spring-boot-starter-jetty
		
		
			org.springframework.boot
			spring-boot-starter-web
		
		
			org.springframework.boot
			spring-boot-starter-test
		
		
		
			org.springframework
			springloaded
		
		
			org.springframework.boot
			spring-boot-devtools
		














		
		
			com.amazonaws
			aws-java-sdk-core
			1.11.125
		

		
			com.amazonaws
			aws-java-sdk-autoscaling
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-bom
			1.11.125
			pom
		

		
			com.amazonaws
			aws-java-sdk-ec2
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-sts
			1.11.125
		

		
		
			org.jdom
			jdom2
			2.0.6
		









		
			org.apache.maven.shared
			maven-dependency-tree
			3.0.1
		
		
			org.vafer
			jdependency
			2.1.1
		
		
			org.ow2.asm
			asm
			7.0-beta
		
		
			org.ow2.asm
			asm-analysis
			7.0-beta
		
		
			org.ow2.asm
			asm-tree
			7.0-beta
		
		
			org.ow2.asm
			asm-commons
			7.0-beta
		
		
			org.ow2.asm
			asm-util
			7.0-beta
		







		
			org.springframework.boot
			spring-boot-loader-tools
			2.2.4.RELEASE
		
		
			org.springframework
			spring-core
			4.3.13.RELEASE
		
		
			org.apache.maven.shared
			maven-shared-utils
			3.2.1
		
		
			org.apache.commons
			commons-lang3
			3.9
		
		
			org.apache.maven
			maven-core
			3.3.9
		
		
			org.apache.maven
			maven-repository-metadata
			3.3.9
		
		
			org.eclipse.aether
			aether-util
			1.0.2.v20150114
		
		
			com.google.inject
			guice
			4.0
		
		
			org.codehaus.plexus
			plexus-archiver
			3.7.0
		
		
			org.ow2.asm
			asm-commons
			7.0
		
		
			com.google.guava
			guava
			19.0
		


	
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				
					
						
							repackage
						
					
				
			
		
	





 

 

工程microservicecloud-provider-dept-8001_03的pom文件完整内容是:


	4.0.0
	
		com.lss.springcloud
		microservicecloud
		0.0.1-SNAPSHOT
	
	microservicecloud-provider-dept-8001_03

	
		
			com.lss.springcloud
			microservicecloud-api
			${project.version}
		

		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
		
		
			org.springframework.cloud
			spring-cloud-starter-config
		

		
		
			org.springframework.boot
			spring-boot-starter-actuator
		



		
			junit
			junit
		
		
			mysql
			mysql-connector-java
		
		
			com.alibaba
			druid
		
		
			ch.qos.logback
			logback-core
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
		
		
			org.springframework.boot
			spring-boot-starter-jetty
		
		
			org.springframework.boot
			spring-boot-starter-web
		
		
			org.springframework.boot
			spring-boot-starter-test
		
		
		
			org.springframework
			springloaded
		
		
			org.springframework.boot
			spring-boot-devtools
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
			com.amazonaws
			aws-java-sdk-core
			1.11.125
		

		
			com.amazonaws
			aws-java-sdk-autoscaling
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-bom
			1.11.125
			pom
		

		
			com.amazonaws
			aws-java-sdk-ec2
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-sts
			1.11.125
		

		
		
			org.jdom
			jdom2
			2.0.6
		









		
			org.apache.maven.shared
			maven-dependency-tree
			3.0.1
		
		
			org.vafer
			jdependency
			2.1.1
		
		
			org.ow2.asm
			asm
			7.0-beta
		
		
			org.ow2.asm
			asm-analysis
			7.0-beta
		
		
			org.ow2.asm
			asm-tree
			7.0-beta
		
		
			org.ow2.asm
			asm-commons
			7.0-beta
		
		
			org.ow2.asm
			asm-util
			7.0-beta
		







		
			org.springframework.boot
			spring-boot-loader-tools
			2.2.4.RELEASE
		
		
			org.springframework
			spring-core
			4.3.13.RELEASE
		
		
			org.apache.maven.shared
			maven-shared-utils
			3.2.1
		
		
			org.apache.commons
			commons-lang3
			3.9
		
		
			org.apache.maven
			maven-core
			3.3.9
		
		
			org.apache.maven
			maven-repository-metadata
			3.3.9
		
		
			org.eclipse.aether
			aether-util
			1.0.2.v20150114
		
		
			com.google.inject
			guice
			4.0
		
		
			org.codehaus.plexus
			plexus-archiver
			3.7.0
		
		
			org.ow2.asm
			asm-commons
			7.0
		
		
			com.google.guava
			guava
			19.0
		


	
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				
					
						
							repackage
						
					
				
			
		
	

		







 

 

 

 

microservicecloud-provider-dept-hystrix-8001工程的pom完整内容是:


	4.0.0
	
		com.lss.springcloud
		microservicecloud
		0.0.1-SNAPSHOT
	
	microservicecloud-provider-dept-hystrix-8001
	

		
		
			org.springframework.cloud
			spring-cloud-starter-hystrix
		




		
			com.lss.springcloud
			microservicecloud-api
			${project.version}
		

		
		
			org.springframework.cloud
			spring-cloud-starter-eureka
		
		
			org.springframework.cloud
			spring-cloud-starter-config
		

		
		
			org.springframework.boot
			spring-boot-starter-actuator
		



		
			junit
			junit
		
		
			mysql
			mysql-connector-java
		
		
			com.alibaba
			druid
		
		
			ch.qos.logback
			logback-core
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
		
		
			org.springframework.boot
			spring-boot-starter-jetty
		
		
			org.springframework.boot
			spring-boot-starter-web
		
		
			org.springframework.boot
			spring-boot-starter-test
		
		
		
			org.springframework
			springloaded
		
		
			org.springframework.boot
			spring-boot-devtools
		












		
		
			com.amazonaws
			aws-java-sdk-core
			1.11.125
		

		
			com.amazonaws
			aws-java-sdk-autoscaling
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-bom
			1.11.125
			pom
		

		
			com.amazonaws
			aws-java-sdk-ec2
			1.11.125
		
		
		
			com.amazonaws
			aws-java-sdk-sts
			1.11.125
		

		
		
			org.jdom
			jdom2
			2.0.6
		









		
			org.apache.maven.shared
			maven-dependency-tree
			3.0.1
		
		
			org.vafer
			jdependency
			2.1.1
		
		
			org.ow2.asm
			asm
			7.0-beta
		
		
			org.ow2.asm
			asm-analysis
			7.0-beta
		
		
			org.ow2.asm
			asm-tree
			7.0-beta
		
		
			org.ow2.asm
			asm-commons
			7.0-beta
		
		
			org.ow2.asm
			asm-util
			7.0-beta
		







		
			org.springframework.boot
			spring-boot-loader-tools
			2.2.4.RELEASE
		
		
			org.springframework
			spring-core
			4.3.13.RELEASE
		
		
			org.apache.maven.shared
			maven-shared-utils
			3.2.1
		
		
			org.apache.commons
			commons-lang3
			3.9
		
		
			org.apache.maven
			maven-core
			3.3.9
		
		
			org.apache.maven
			maven-repository-metadata
			3.3.9
		
		
			org.eclipse.aether
			aether-util
			1.0.2.v20150114
		
		
			com.google.inject
			guice
			4.0
		
		
			org.codehaus.plexus
			plexus-archiver
			3.7.0
		
		
			org.ow2.asm
			asm-commons
			7.0
		
		
			com.google.guava
			guava
			19.0
		


	
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				
					
						
							repackage
						
					
				
			
		
	




 

 

在eclipse启动

SpringCloud十八、豪猪服务监控hystrixDashboard。_第9张图片

 

图案是豪猪。(豪华的豪、猪狗的猪)

你可能感兴趣的:(SpringCloud十八、豪猪服务监控hystrixDashboard。)