0043-Hystrix Dashbord监控单机Ribbon

1. 说明

Hystrix Dashbord是一个监控模块,用来监控Hystrix的各项指标。这边文章使用的spring cloud的Finchley版本,Hystrix的的调用信息不再是http://hystrix-app:port/hystrix.stream,而是变为了http://hystrix-app:port/actuator/hystrix.stream,另外由于 endpoints 中会包含很多敏感信息,除了 health 和 info 两个支持 web 访问外,其他的默认不支持 web 访问,需要在yml配置文件中配置开启
官网
博文

2. 搭建Dashbord仪表盘项目

2.1 pom依赖
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <!--Finchley版本的hystrix需要加上netflix-->
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.cloud</groupId>
        <artifactId>spring-cloud-starter-netflix-hystrix-dashboard</artifactId>
    </dependency>
</dependencies>
2.2 yml配置
server:
  port: 10001
2.3 主启动类
@SpringBootApplication
@EnableHystrixDashboard
public class EurekaConsumeHystrixDashbord10001 {
    public static void main(String[] args) {
        SpringApplication.run(EurekaConsumeHystrixDashbord10001.class, args);
    }
}
2.4 测试

访问http://localhost:10001/hystrix会出现下面页面
这时候访问http://hystrix-app:port/actuator/hystrix.stream是访问不通的,需要改造使用Hystrix的Consumer项目

3 改造Consumer

3.1 增加依赖

Consumer项目需要actuator的依赖

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
3.2 yml配置

配置文件打开stream的endpoints

management:
  endpoints:
    web:
      exposure:
        include: hystrix.stream
3.3 测试

http://localhost:9001/actuator/hystrix.stream会出现ping的界面表示成功

4. 监控项目

进入仪表盘项目首页http://localhost:10001/hystrix,输入需要监控的消费者的/autuator/hystrix.stream路径即可
1
然后就可以看到监控页面

2

关于监控器的指标可以查看下图

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值