(1)、添加starter依赖

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

(2)、配置相关信息

 info.app.id=user
info.app.version=1.0.0
#management.endpoint.shutdown.enabled 远程关闭应用
management.endpoint.shutdown.enabled=true
#management.endpoint.beans.enabled 关闭此监控端点
management.endpoint.beans.enabled=false

*更多设置可以查看官网文档。

*监控管理请求映射表

路径 描述
autoconfig 所有自动配置信息
auditevens 审计事件
beans 所有Bean的信息
configprops 所有配置属性
dump 线程状态信息
env 当前环境信息
health 应用健康状况
info 当前应用信息
metrics 应用的各项指标
mappings 应用@RequestMapping映射路径
shutdown 关闭当前应用(默认此路径关闭)
trace 追踪信息(最新的http请求)

*(3)、自定义健康状态指示器

  1.编写一个指示器实现HealthIndicator接口

  2.指示器的名称 xxxHealthIndicator

  3.将自定义的指示器加入到容器中

 package cn.coreqi.config;

 import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component; @Component
public class MyAppHealthIndicator implements HealthIndicator {
@Override
public Health health() {
/*
//自定义的检查方式
*/
Health.up().build(); //代表健康,服务没问题。
Health.down().withDetail("message","服务异常").build(); //服务GG了
return null;
}
}

SpringBoot集成监控管理的更多相关文章

  1. java框架之SpringBoot(17)-监控管理

    介绍 SpringBoot 提供了监控管理功能的场景启动器,它可以为我们提供准生产环境下的应用监控和管理功能.我们可以通过HTTP.JMX.SSH协议来进行操作,自动得到审计.健康及指标信息等. 使用 ...

  2. 二十二、springboot之监控管理Actuator

    1.新增spring-boot-starter-actuator的依赖 gradle: compile('org.springframework.boot:spring-boot-actuator') ...

  3. springboot集成AOP管理日志

    如何将所有的通过url的请求参数以及返回结果都输出到日志中? 如果在controller的类中每个方法名都写一个log输出肯定是不明智的选择. 使用spring的AOP功能即可完成. 1. 在pom. ...

  4. SpringBoot集成Actuator监控管理

    1.说明 本文详细介绍Spring Boot集成Actuator监控管理的方法, 基于已经创建好的Spring Boot工程, 然后引入Actuator依赖, 介绍监控管理相关功能的使用. Sprin ...

  5. SpringBoot | 第二十八章:监控管理之Spring Boot Admin使用

    前言 上一章节,我们介绍了Actuator的使用,知道了可通过访问不同的端点路径,获取相应的监控信息.但使用后也能发现,返回的监控数据都是以JSON串的形式进行返回的,对于实施或者其他人员来说,不是很 ...

  6. SpringBoot | 第二十七章:监控管理之Actuator使用

    前言 随着我们服务越来越多,部署的环境也越来越繁多时,由于各服务都部署在不同的机器上,每当出现问题或者异常时,想快速进行问题的定位就变的麻烦了.所以,本章节开始,开始讲解SpringBoot的监控相关 ...

  7. SpringBoot集成Zipkin实现分布式全链路监控

    目录 Zipkin 简介 Springboot 集成 Zipkin 安装启动 zipkin 版本说明 项目结构 工程端口分配 引入 Maven 依赖 配置文件.收集器的设置 编写 Controller ...

  8. SpringBoot集成Spring Security(6)——登录管理

    文章目录 一.自定义认证成功.失败处理 1.1 CustomAuthenticationSuccessHandler 1.2 CustomAuthenticationFailureHandler 1. ...

  9. SpringBoot学习笔记(三):SpringBoot集成Mybatis、SpringBoot事务管理、SpringBoot多数据源

    SpringBoot集成Mybatis 第一步我们需要在pom.xml里面引入mybatis相关的jar包 <dependency> <groupId>org.mybatis. ...

随机推荐

  1. day30 item系列

    item 会将数据操作类似于字典的操作具体用到的方法 __getitem__(self, item): __setitem__(self, key, value): __delitem__(self, ...

  2. Mysql读写分离php脚本

    <?php/*php如何连接mysql*/ /*$link = mysql_connect(‘localhost‘, ‘root‘, ‘‘);if (!$link) {die(‘Could no ...

  3. 趣谈生成函数 =v=

    趣谈生成函数 =v= 今天luyouqi在洛谷随机跳题rand出来一道生成函数板子题,然后我给做了(雾 发现小伙伴们还不会生成函数,于是我试着写这篇生成函数简介.(其实我也不怎么会生成函数这么高级的东 ...

  4. [luogu3919]可持久化数组【主席树】

    链接:https://www.luogu.org/problemnew/show/P3919 分析 很明显我们可以用主席树来维护,所谓主席树就是可持久化线段树,能够查询历史版本而且可以实现修改操作,反 ...

  5. Elasticsearch GC 时间过长的解决方法

    前言:GC 时间过长是个常见的问题,下文我将对应的现象和解决方案进行阐述.为什么这么解决,可以参考我的另外一个博客中的内存使用和GC指标这个章节 我们有时会发现elasticsearch集群挂掉,或者 ...

  6. A1032. Sharing

    To store English words, one method is to use linked lists and store a word letter by letter. To save ...

  7. 【洛谷P1347】排序

    题目大意:给定 N 个变量和 M 个变量之间的偏序关系,问能否求出这 N 个变量之间的一个全序.若能,输出最少利用多少条已知信息即可求的结果,且输出该全序:若无解,输出到第几条已知信息可以判定无解:若 ...

  8. csp20141203 集合竞价 解题报告

    Solution:对股票出价进行排序,然后按照价格递增的次序依次设定p的价格并求成交量.1. //prove that the result of price(maximum--maxprice) i ...

  9. linux command ------ tar

    -c: compress archives -x:decompress archives -t:check archives -z:whether it has the attribute of gz ...

  10. xvfb-run: error: xauth command not found 解决方式

    解决方式转于:http://tokanao.com/blog/2016/07/13/blog.html 错误提示 array(2) { [0]=> string(27) "which: ...