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 版权声明:本文为博主原创文章,转载请附上博文链接! 引言 很多文章都 ...
随机推荐
- Hadoop源码学习笔记(1) ——第二季开始——找到Main函数及读一读Configure类
Hadoop源码学习笔记(1) ——找到Main函数及读一读Configure类 前面在第一季中,我们简单地研究了下Hadoop是什么,怎么用.在这开源的大牛作品的诱惑下,接下来我们要研究一下它是如何 ...
- sprintf 格式化字符串
好久没写博客了,又遇到自己觉得很傻的问题,格式化字符串还要找下 定义和用法 sprintf() 函数把格式化的字符串写入变量中. arg1.arg2.++ 参数将被插入到主字符串中的百分号(%)符号处 ...
- 用户登录注册(安全)(常规、FB、google、paypal) 实战
/* 用户登录界面 */elseif ($action == 'login'){ if($_SESSION['user_id']) { ecs_header("Lo ...
- HDU2048 神,上帝以及老天爷 错排
http://acm.hdu.edu.cn/showproblem.php?pid=2048 这是一道错排的题目 错排如下:http://baike.baidu.com/link?url=U2_H-4 ...
- Apache shiro的简单介绍与使用(与spring整合使用,并加入ehcache缓存权限数据)
apache shiro框架简介 Apache Shiro是一个强大而灵活的开源安全框架,它能够干净利落地处理身份认证,授权,企业会话管理和加密.现在,使用Apache Shiro的人越来越多,因为它 ...
- AngularJS+RequireJs实现动态加载JS和页面的方案研究【下】
about.js: [html] view plain copy 在CODE上查看代码片派生到我的代码片 define(['app'], function(app) { app.controller( ...
- 利用open live writer工具的Metaweblog技术API接口同步到多个博客。
测试例子内容: hello world hello metaweblog hello open live writer
- 中国国内 - 可用API合集
中国国内 - 可用API合集 收录一篇中国国内可用API合集,分享给大家 目录 笔记 出行 词典 电商 地图 电影 即时通讯 开发者网站 快递查询 旅游 社交 视频 天气 团队协作 图片与图像处理 外 ...
- *.vue文件的template标签内使用form标签
由于form表单有重复提交的问题,所以在vue文件内直接使用form标签时需要注意这个问题,否则会导致页面重复刷新跳转不成功的问题 解决方案: <form @submit.prevent> ...
- visual box 安装 centos7后,无法上网
ifconfig 命令后,只看到个回环网卡: 进入 /etc/sysconfig/network-scripts后,发现有设备 visual box 中设置为“桥接网卡”,也没问题,最后把控制芯片改 ...