SpringBoot——监控

Actuator监控使用步骤

1.导入坐标依赖

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

2.访问http://localhost:8080/actuator

http://localhost:8080/actuator

{
    "_links": {
        "self": {
            "href": "http://localhost:8080/actuator",
            "templated": false
        },
        "health-path": {
            "href": "http://localhost:8080/actuator/health/{*path}",
            "templated": true
        },
        "health": { //健康检查,非详细信息
            "href": "http://localhost:8080/actuator/health",
            "templated": false
        },
        "info": { //配置文件中以info开头的属性信息
            "href": "http://localhost:8080/actuator/info",
            "templated": false
        }
    }
}

http://localhost:8080/actuator/info
配置文件中以info开头的属性信息(application.properties)

info.author=aikin
info.date=2020.12.08
{
    "author": "aikin",
    "date": "2020.12.08"
}

http://localhost:8080/actuator/health
健康检查(可以检查引入的第三方的组件,如redis的状态)

#开启健康检查的完整信息
management.endpoint.health.show-details=always

暴露所有监控的endpoints(默认只有health和info)

#将所有监控的endpoints暴露出来
management.endpoints.web.exposure.include=*

Spring Boot Admin监控(图形化界面)

●Spring Boot Admin 是一个开源社区项目,用于管理和监控SpringBoot应用程序。(图形化界面)
●Spring Boot Admin 有两个角色,客户端(client)和服务端(server)。

1.admin-server

①创建admin-server模块
②导入依赖坐标admin-starter-server
③在引导类上启动监控功能@EnableAdminServer

server.port=9090

2.admin-client

①创建admin-client模块
②导入依赖坐标admin-starter-client
③配置相关信息,server地址等

#指定admin.server的地址
spring.boot.admin.client.url=http://localhost:9090

④启动server和client服务,访问server
http://localhost:9090/

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值