JVM监控:springboot actuator + springboot admin

最近几个月天天加班,好久没更新博客了。
这两天排查一个CPU飙高导致服务假死的问题,常规套路:
jps
top -H -p 进程ID
jstack -l 高CPU线程
以上常规套路相信大家都比较熟练,但是当节点比较多的时候,就需要挨个进到机器或容器内,查看jvm堆栈情况,耗时耗力,如果能使用可视化工具就方便多了。Arthas(阿尔萨斯)需要单独部署成进程,部署复杂;springboot actuator作为信息采集客户端,springboot admin作为可视化页面,侵入性较小,因此选择后者,废话不多,上代码

1、业务服务(监控客户端)

1)pom

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>2.3.1</version>
        </dependency>

2)配置

server:
  port: 8080
spring:
  application:
    name: test_server
    admin:
      enabled: true
  boot:
    admin:
      client:
        # 如果不是在同一个节点,只要使用内网地址和端口即可,容器部署需要将容器端口映射到宿主机
        # springboot admin server 地址
        url: http://127.0.0.1:3001
        # springboot admin client 地址
        instance:
          service-url: http://127.0.0.1:8080


# springboot actuator
management:
  endpoints:
    web:
      exposure:
        include: info,health,metrics,httptrace,env,scheduledtasks,threaddump,heapdump
  endpoint:
    health:
      show-details: always

2、监控及可视化服务(监控服务端)

1)pom

    <dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>de.codecentric</groupId
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值