1. 新建一个maven项目--导入依赖

<dependency>

    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
    <version>1.4.6.RELEASE</version>
</dependency>

 

2.设置端口号:

#配置项目端口号
server:
  port: 9001

3.在启动类上开启监控

@SpringBootApplication
@EnableHystrixDashboard //开启监控
public class DeptComsumerDashboard_9001 {

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

以上基本完成监控,可以去 http://localhost:端口号/hystrix,如果出现以下画面,说明成功一半了

hystrix-bashboard 的监控

2大类,去哪监控 如服务端监控

1.在服务端一定要添加监控的依赖
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

3.在服务端的启动类上添加写死的bean

@Bean
public ServletRegistrationBean hystrixMetricsStreamServlet(){
    ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new HystrixMetricsStreamServlet());
    servletRegistrationBean.addUrlMappings("/actuator/hystrix.stream");
    return servletRegistrationBean;

}

3.localhost:服务器的端口号/actuator/hystrix.stream ,将其复制到

hystrix-bashboard 的监控

 

4.添加delay时间,和title主题,然后点击monitor stream 进入页面

hystrix-bashboard 的监控

5.随意的访问服务端的各个接口,观察其变化⚪,和对应的颜色

 

相关文章:

  • 2021-11-27
  • 2021-08-30
  • 2022-12-23
  • 2021-08-17
  • 2022-12-23
  • 2021-09-05
  • 2021-07-01
  • 2021-06-18
猜你喜欢
  • 2021-09-22
  • 2021-09-03
  • 2021-04-28
  • 2021-07-23
  • 2022-12-23
  • 2021-06-03
相关资源
相似解决方案