在生产环境中,须要实时或按期监控服务的可用性,spring-Boot的Actuator 功能提供了不少监控所需的接口。node
Actuator是Spring Boot提供的对应用系统的自省和监控的集成功能,能够对应用系统进行配置查看、健康检查、相关功能统计等,通常运维人员使用多些。web
咱们这里监控03-springboot-web程序spring
<!--Spring Boot Actuator依赖--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
我这里没有进行配置json
server.port=8080浏览器
server.servlet.context-path=/03-springboot-webspringboot
management.server.port=8100app
management.server.servlet.context-path=/03-springboot-web运维
#默认只开启了health和info,设置为*,则包含全部的web入口端点 management.endpoints.web.exposure.include=*
默认没有内容spring-boot
须要本身在application.properties配置文件中添加信息,须要以info开头,后面的内容能够本身设定,通常配置项目的版权等信息,例如url
#配置项目版权相关信息 info.contact.email=bjpowernode@163.com info.contact.phone=010-84846003
配置完毕后,重启项目再进行访问
HTTP方法 |
路径 |
描述 |
GET |
/configprops |
查看配置属性,包括默认配置 |
GET |
/beans |
查看Spring容器目前初始化的bean及其关系列表 |
GET |
/env |
查看全部环境变量 |
GET |
/mappings |
查看全部url映射 |
GET |
/health |
查看应用健康指标 |
GET |
/info |
查看应用信息 |
GET |
/metrics |
查看应用基本指标 |
GET |
/metrics/{name} |
查看具体指标 |
JMX |
/shutdown |
关闭应用 |
shutdown的使用
注意:/shutdown不能直接在浏览器中访问
# 启用关闭springboot的服务 management.endpoint.shutdown.enabled=true