spring boot admin 2.1.6 监控搭建总结

最近在做新系统的框架搭建,想要给系统加一个监控应用的模块,感觉 spring boot admin 不错,就把他集成进来了。做个简单总结
我这里采用的是 maven 多module 形式,新起 一个spring boot admin 微服务,能后在其他服务器中导入相关jar 和配置就可以了,简单方便。

新建spring boot admin 服务端

新起一个叫 admin 的 module
其中 pom.xml 需要导入如下依赖

<dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>2.1.6</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
        </dependency>

配置文件

server:
  port: 10005
spring:
  application:
    name: admin
  aop:
    proxyTargetClass: true
eureka:
  instance:
    prefer-ip-address: true
    instance-id: ${spring.cloud.client.ip-address}:${server.port}
    hostname: ${spring.cloud.client.ip-address}
  client:
    service-url:
      defaultZone: http://127.0.0.1:10001/eureka/

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

启动类, 加入 EnableAdminServer 注解

@SpringBootApplication
@EnableAdminServer
public class AdminApplication {

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

}

原有微服务改造

很简单就两步

  1. 引入 actuator 依赖
 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
  1. 增加如下配置
management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: always

到这整合完毕,启动项目 打开浏览器 访问admin 项目 (127.0.0.1:1005)就能看到效果了
在这里插入图片描述

问题:

  1. 服务器启动成功,也能正常访问,但是状态还是显示 down
    原因: 只要有一个监控内容为down,改节点就为down ,可得点开详情,在右侧查看具体down 的服务,能后进行排查
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 11
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值