Spring Boot 监控和管理生产环境

spring-boot-actuator模块提供了一个监控和管理生产环境的模块,可以使用http、jmx、ssh、telnet等拉管理和监控应用。审计(Auditing)、

健康(health)、数据采集(metrics gathering)会自动加入到应用里面。

首先,写一个最基本的spring boot项目。

基于Maven的项目添加‘starter’依赖:

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

以下是所有监控描述:

HTTP方法

路径

描述

鉴权

GET

/autoconfig

查看自动配置的使用情况,

该报告展示所有auto-configuration候选者及它们被应用或未被应用的原因

true

GET

/configprops

显示一个所有@ConfigurationProperties的整理列表

true

GET

/beans

显示一个应用中所有Spring Beans的完整列表

true

GET

/dump

打印线程栈

true

GET

/env

查看所有环境变量

true

GET

/env/{name}

查看具体变量值

true

GET

/health

查看应用健康指标

false

GET

/info

查看应用信息

false

GET

/mappings

查看所有url映射

true

GET

/metrics

查看应用基本指标

true

GET

/metrics/{name}

查看具体指标

true

POST

/shutdown

允许应用以优雅的方式关闭(默认情况下不启用)

true

GET

/trace

查看基本追踪信息

true

比如:http://localhost:8080/health  
你可以得到应用健康指标结果

{
status: "UP",
diskSpace: {
status: "UP",
total: 107374174208,
free: 14877962240,
threshold: 10485760
}
} 

比如:http://localhost:8080/env
你可以得到所有环境变量结果

转载于:https://my.oschina.net/liuyuantao/blog/807206

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值