springboot2.0系列十二(整合Actuator监控应用)

Actuator监控应用

Actuator是spring boot的一个附加功能,可帮助你在应用程序生产环境时监视和管理应用程序。可以使用HTTP的各种请求来监管,审计,收集应用的运行情况.特别对于微服务管理十分有意义.缺点:没有可视化界面。

Maven依赖

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

application.properties

###通过下面的配置启用所有的监控端点,默认情况下,这些端点是禁用的;
#开放所有的web endpoints
management.endpoints.web.exposure.include= *

info.name= lph
info.addres= sh

Actuator访问路径

通过actuator/+端点名就可以获取相应的信息。

访问http://localhost:8080/actuator 可以查看到所有的监控节点的访问路径

路径

作用

/actuator/beans

显示应用程序中所有Spring bean的完整列表。

/actuator/configprops

显示所有配置信息。

/actuator/env

陈列所有的环境变量。

/actuator/mappings

显示所有@RequestMapping的url整理列表。

/actuator/health

显示应用程序运行状况信息 up表示成功 down失败

/actuator/info

查看自定义应用信息

演示案例:

 http://localhost:8080/actuator/info  查看自定义应用信息

 http://localhost:8080/actuator/health

 

猜你喜欢

转载自blog.csdn.net/wota5037/article/details/111479279