Spring Boot与监控管理
概念:
通过引入spring-boot-starter-actuator,可以使用Spring Boot为我们提供的准生产环境下的应用监控和管理功能。我们可以通过HTTP,JMX,SSH协议来进行操作,自动得到审计、健康及指标信息等。
步骤:
- 引入spring-boot-starter-actuator
- 通过http方式访问监控端点
- 可进行shutdown(POST 提交,此端点默认关闭)
监控和管理端点中文对照

常用定制端点信息方法:
1.定制端点一般通过endpoints+端点名+属性名来设置。
2.修改端点id(endpoints.beans.id=mybeans)
3.开启远程应用关闭功能(endpoints.shutdown.enabled=true)
4.关闭端点(endpoints.beans.enabled=false)
5.开启所需端点
endpoints.enabled=false endpoints.beans.enabled=true
6.定制端点访问根路径
management.context-path=/manage
7.关闭http端点
management.port=-1
springboot版本:1.5.12
http://localhost:8080/info 可以查看git的配置信息
git.properties:
git.branch=master
git.commit.id=xjkd33s
git.commit.time=2017-12-12 12:12:56
application.properties:
#设置监控端点可见
management.security.enabled=false #测试redis的health
spring.redis.host=192.168.0.113 #设置localhost:8080/info的值
info.app.id=hello
info.app.version=1.0.0 #设置metrics端点不可见
#endpoints.metrics.enabled=false
endpoints.shutdown.enabled=true #设置beans的名字,改后访问路径为:localhost:8080/mybean
#endpoints.beans.id=mybean
#设置beans的访问路径,改后访问路径为:localhost:8080/bean
#endpoints.beans.path=/bean
#endpoints.beans.enabled=false
#
#endpoints.dump.path=/du # 关闭所有端点访问
#endpoints.enabled=false
# 打开beans端点的访问
#endpoints.beans.enabled=true #设置访问端点前缀
management.context-path=/manage
#设置访问端口号
management.port=8181
自定义HealthIndicator:
/*
* 自定义健康状态指示器
* 1.编写一个指示器 实现healthIndicator 接口
* 2.指示器名字 xxxxHealthIndicator
* 3.加入容器中
* */ @Component
public class MyAppHealthIndicator implements HealthIndicator {
@Override
public Health health() { //自定义的检查方法
//return Health.up().build();//代表健康
return Health.down().withDetail("msg","服务异常").build();
}
}
Spring Boot与监控管理的更多相关文章
- spring Boot(十九):使用Spring Boot Actuator监控应用
spring Boot(十九):使用Spring Boot Actuator监控应用 微服务的特点决定了功能模块的部署是分布式的,大部分功能模块都是运行在不同的机器上,彼此通过服务调用进行交互,前后台 ...
- (39.4) Spring Boot Shiro权限管理【从零开始学Spring Boot】
在读此文章之前您还可能需要先了解: (39.1) Spring Boot Shiro权限管理[从零开始学Spring Boot] http://412887952-qq-com.iteye.com/b ...
- (39.3) Spring Boot Shiro权限管理【从零开始学Spring Boot】
在学习此小节之前您可能还需要学习: (39.1) Spring Boot Shiro权限管理[从零开始学Spring Boot] http://412887952-qq-com.iteye.com/b ...
- (39.2). Spring Boot Shiro权限管理【从零开始学Spring Boot】
(本节提供源代码,在最下面可以下载) (4). 集成Shiro 进行用户授权 在看此小节前,您可能需要先看: http://412887952-qq-com.iteye.com/blog/229973 ...
- (39.1) Spring Boot Shiro权限管理【从零开始学Spring Boot】
(本节提供源代码,在最下面可以下载)距上一个章节过了二个星期了,最近时间也是比较紧,一直没有时间可以写博客,今天难得有点时间,就说说Spring Boot如何集成Shiro吧.这个章节会比较复杂,牵涉 ...
- Spring Boot (十): Spring Boot Admin 监控 Spring Boot 应用
Spring Boot (十): Spring Boot Admin 监控 Spring Boot 应用 1. 引言 在上一篇文章<Spring Boot (九): 微服务应用监控 Spring ...
- Spring Boot Actuator监控使用详解
在企业级应用中,学习了如何进行SpringBoot应用的功能开发,以及如何写单元测试.集成测试等还是不够的.在实际的软件开发中还需要:应用程序的监控和管理.SpringBoot的Actuator模块实 ...
- Springboot 系列(十七)迅速使用 Spring Boot Admin 监控你的 Spring Boot 程序,支持异常邮件通知
1. Spring Boot Admin 是什么 Spring Boot Admin 是由 codecentric 组织开发的开源项目,使用 Spring Boot Admin 可以管理和监控你的 S ...
- 使用 Spring Boot Admin 监控应用状态
程序员优雅哥 SpringBoot 2.7 实战基础 - 11 - 使用 Spring Boot Admin 监控应用状态 1 Spring Boot Actuator Spring Boot Act ...
随机推荐
- 剑指offer——19删除链表的节点
题目一: 在O(1)时间内删除链表节点.给定单向链表的头指针和一个节点指针,定义一个函数在O(1)时间内删除该节点. 书本讲得不明就里 class Solution { void DeleteNode ...
- 读取.properties配置文件(转载)
读取.properties 文件 配置文件的一种,内容以键值对的形式存在,且每个键值对独占一行.#号作为行注释的起始标志,中文注释会自动进行unicode编码.示例: # ip and port of ...
- 测试Tensorflow-GPU的例子
import tensorflow as tf # import os # os.environ['TF_CPP_MIN_LOG_LEVEL']='2' a = tf.placeholder(tf.i ...
- Servlet共享数据
共享数据: 1.域对象:有一个作用范围的对象,可以在范围内共享数据 2.request域:代表一次请求范围,一般用于请求转发的多个资源中共享数据 方法: 1.存储数据:setAttrbute(Stri ...
- 深度探索C++对象模型之第二章:构造函数语意学之Copy constructor的构造操作
C++ Standard将copy constructor分为trivial 和nontrivial两种:只有nontrivial的实例才会被合成于程序之中.决定一个copy constructor是 ...
- window.onload=function(){};
window.onload=function(){}; 只要页面加载完毕,这个事件才会触发 扩展事件--页面关闭后才触发的事件 window.onunload=function(){}; 扩展事件-- ...
- LR调试脚本的时候报错Error -27796:(已解决)
LR调试bbs脚本的时候报错: 1.Error -27796: Failed to connect to server "192.168.211.128:80": [10060] ...
- thinkphp ajax返回
ThinkPHP可以很好的支持AJAX请求,系统的\Think\Controller类提供了ajaxReturn方法用于AJAX调用后返回数据给客户端.并且支持JSON.JSONP.XML和EVAL四 ...
- helm安装kubernetes的插件istio
1.安装istio 要使用Helm自定义Istio安装,请使用--set <key>=<value>Helm命令中的选项覆盖一个或多个值 怎么使用选项配置请查看官网https: ...
- JavaScript——基本语法
单词掌握 BOM 浏览器对象模型 DOM 文档对象模型 document 文档 break 中断 continue 继续 1.js脚本位置 通常可以在三个地方编写js脚本代码,一是在网页文件的< ...