SpringCloud Hystrix服务监控Dashboard

 

个人博客网:www.lfuping.cn    (你想要这里多有)

Hystrix服务监控Dashboard仪表盘

Hystrix提供了 准实时的服务调用监控项目Dashboard,能够实时记录通过Hystrix发起的请求执行情况,可以通过图表的形式展现给用户看。

一、新建项目springcloud-hystrix-dashboard-1并添加pom.xml依赖:

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-hystrix-dashboard</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

application.yml配置

server:
  port: 9090
  context-path: /

二、新建启动类HystrixDashboardApplication
加注解:@EnableHystrixDashboard

package com.li.spingcloud.hystrix.dashboard;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.cloud.netflix.hystrix.dashboard.EnableHystrixDashboard;
@EnableHystrixDashboard
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class })
public class HystrixDashboardApplication {
    public static void main(String[] args) {
        SpringApplication.run(HystrixDashboardApplication.class, args);
    }
}

启动这个项目;
然后浏览器输入:http://localhost:9090/hystrix/

三、测试

  1. 先启动eureka单机或者集群(集群记得修改配置);
  2. 在启动服务生产者单机或者集群;
  3. 然后启动服务消费者;
  4. 请求http://localhost:8080/consumer/list
    返回正常业务;
  5. 启动springcloud-hystrix-dashboard-1监控;在浏览器直接输入地址http://localhost:1001/hystrix.stream这个路径即可;(localhost:1001这个是需要监控的服务地址和端口)一直是ping,然后data返回数据;
  6. 用图形化:

    输入 ,然后点击按钮即可;Delay=监控时数据刷新时间毫秒单位,Title=是监控的名称

    指标含义:

源码链接: https://pan.baidu.com/s/1TaxcDK6EHNiYO9mI1D2z4g

提取码: 63yk

                                              

                                                   

                                                     欢迎关注我的微信公众号:平川大叔

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值