35、springboot-运行状态监控使用Actuator
Spring Boot Actuator 提供了运行状态监控的功能 Actuator 监控数据可以通过阻REST
远程 shell 和JMX方式获得。我 首先来介绍通过 REST 方式查看 Actuator 的节点的方法,这
种是最常见且简单的方法。
通过执行器端点,您可以监控应用程序并与之交互。Spring Boot包含许多内置端点,允许您
添加自己的端点。例如, health端点提供基本的应用程序健康信息。
可以启用或禁用每个端点。它控制是否创建端点并且其bean存在于应用程序上下文中。要进行
远程访问,还必须通过JMX或HTTP公开端点 。大多数应用程序选择HTTP,其中端点的ID
以及前缀/actuator 映射到URL。例如,默认情况下,health端点映射到/actuator/health。
官方文档地址:https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-endpoints.html
1、新建工程添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
2.springboot2.x的配置
server.port=
management.server.port=8083
#开放所有页面节点 默认只开启了health、info两个节点
management.endpoints.web.exposure.include=* #actuator端口 #修改访问路径 .0之前默认是/ .0默认是 /actuator 可以通过这个属性值修改
#management.endpoints.web.base-path: /actuator #显示健康具体信息 默认不会显示详细信息
management.endpoint.health.show-details:ALWAYS
启动项目!!
3、访问http://localhost:8083/actuator
除了shutdown请求为post,其他的皆为GET请求

可以使用以下与技术无关的端点:


应用程序是Web应用程序(Spring MVC,Spring WebFlux或Jersey)
则可以使用以下附加端点:

Actuator 端口信息


启用端点
默认情况下,shutdown启用除除以外的所有端点。要配置端点的启用,请使用其
management.endpoint.<id>.enabled属性。以下示例启用shutdown端点:
management.endpoint.shutdown.enabled = true
如果您希望端点启用是选择加入而不是选择退出,请将该
management.endpoints.enabled-by-default属性设置 为false并使用各个端点 enabled属性重新加入。
以下示例启用info端点并禁用所有其他端点:
management.endpoints.enabled-by-default = false
management.endpoint.info.enabled = true
3、个别接口的使用:
health
http://localhost:8083/actuator/health
{
"status": "UP",
"details": {
"diskSpace": {
"status": "UP",
"details": {
"total": ,
"free": ,
"threshold":
}
}
}
}
/health API 接口提供的信息是由 个或多个健康指示器提供的健康信息的组合结果
Spring Boot 自带的健康指示器

具体看官网...........
35、springboot-运行状态监控使用Actuator的更多相关文章
- 二十二、springboot之监控管理Actuator
1.新增spring-boot-starter-actuator的依赖 gradle: compile('org.springframework.boot:spring-boot-actuator') ...
- 【spring cloud】【spring boot】网管服务-->配置文件添加endpoints.enabled = false,SpringBoot应用监控Actuator使用的安全隐患
转载:https://xz.aliyun.com/t/2233 ==================================================================== ...
- springboot(十九)使用actuator监控应用【转】【补】
springboot(十九)使用actuator监控应用 微服务的特点决定了功能模块的部署是分布式的,大部分功能模块都是运行在不同的机器上,彼此通过服务调用进行交互,前后台的业务流会经过很多个微服务的 ...
- 老司机的应用级监控——spring actuator(转)
转自:https://www.jianshu.com/p/c043d3c71f47 什么是spring actuator? 这是一个研发老司机与运维同学都会非常喜欢的东西,随着点融集团的扩张,点融网的 ...
- 老司机的应用级监控——spring?actuator
http://mt.sohu.com/20160824/n465783118.shtml ************************************************ 1什么是sp ...
- 面试官:聊一聊SpringBoot服务监控机制
目录 前言 SpringBoot 监控 HTTP Endpoints 监控 内置端点 health 端点 loggers 端点 metrics 端点 自定义监控端点 自定义监控端点常用注解 来,一起写 ...
- SpringBoot服务监控
SpringBoot服务监控分为客户端和服务端,即服务端是监控方,客户端为被监控方. 例如需要对线上的SpringBoot服务project-A进行监控,则project-A 为客户端.而监控的服务p ...
- Springboot监控之一:SpringBoot四大神器之Actuator之3-springBoot的监控和管理--指标说明
Spring Boot包含很多其他的特性,它们可以帮你监控和管理发布到生产环境的应用.你可以选择使用HTTP端点,JMX或远程shell(SSH或Telnet)来管理和监控应用.审计(Auditing ...
- SpringBoot第二十二篇:应用监控之Actuator
作者:追梦1819 原文:https://www.cnblogs.com/yanfei1819/p/11226397.html 版权声明:本文为博主原创文章,转载请附上博文链接! 引言 很多文章都 ...
随机推荐
- Dapper扩展
using Dapper; using MySql.Data.MySqlClient; using System; using System.Collections.Generic; using Sy ...
- Qless 相关知识
Qless是一个基于redis的分布式任务架构.相关代码在 https://github.com/seomoz/qless 它是完全有lua实现的,依靠 redis 对lua的支持,http://ww ...
- HDU 4248 A Famous Stone Collector 组合数学dp ****
A Famous Stone Collector Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 32768/32768 K (Ja ...
- Java与C++区别:重载(Overloading)
Java中一个类的函数重载可以在本类中的函数和来自父类中的函数之间进行,而C++类中的函数重载只能是本类中的(即不包括来自父类的函数),这是他们一个非常重要的区别.在其他方面的要求都是一致的,即要求函 ...
- PHP获取地址栏传的id值
function getQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&] ...
- JDBC基本操作示例
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import ...
- WinForm实现Rabbitmq官网6个案例-Work Queues
代码: namespace RabbitMQDemo { public partial class WorkQueues : Form { private string queueName = &qu ...
- FormData js对象的介绍和使用
FormData js对象的介绍和使用 FormData对象,可以把所有表单元素的name与value组成一个queryString,提交到后台. 在使用ajax提交时,使用FormData对象可以减 ...
- 《Linux命令行与Shell脚本编程大全第2版》读书笔记
公司说不准用云笔记了,吓得我赶紧把笔记贴到博客上先..... 近3年前的了,只有一半的章节,后面的没空记录了.... 第1章 可以cat /proc/meminfo文件来观察Linux系统上虚拟内存的 ...
- bootstrap 的模态框的宽与高设置
1,改变bootstrap 的宽与高, 将style=“height:900px”放在<div class = "modal-dialog">或者更外层上,整个模态框的 ...