一、简介 Actuator(激励者;执行器)是Spring Boot提供的一个可挺拔模块,用于对工程进行监控。其通过不同的监控终端实现不同的监控功能。其功能与Dubbo的监控中心类似,不同的是,D
一、简介
Actuator(激励者;执行器)是Spring Boot提供的一个可挺拔模块,用于对工程进行监控。其通过不同的监控终端实现不同的监控功能。其功能与Dubbo的监控中心类似,不同的是,Dubbo的监控中心是需要专门部署的,而Spring Boot的Actuator是存在于每一个工程中的。
二、依赖
随便一个Spring Boot工程中都可以使用Actuator对其进行监控。
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency>
三、配置
#-----------------------------------Actuator监控器------------------------------------
# Actuator监控端口与控制中心,默认只开启info、与health监控
# http://localhost:9999/actuator/beans
management:
server:
port: 9999 #设置Actuator监控端口
endpoints:
web:
exposure:
include: '*' #打开Actuator所有监控
#exclude: ['env','beans']
base-path: /actuator #设置Actuator监控基本路径
#-----------------------------------INFO------------------------------------
#自定义INFO信息
#浏览器访问 http://localhost:9999/actuator/info
info:
company:
name: '公司名称'
url: 'www.xxxx'
addr: 'china'
四、访问测试
1、beans终端
http://localhost:9999/actuator/beans

2、env
http://localhost:9999/actuator/env

3、自定义信息

五、常用的监控终端
在百度搜索“springboot actuator”即可找到如下表格
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持易盾网络。
