一、什么是spring-boot-starter-actuator(doc

springboot项目如何检查配置与运行状态呢?官方提供了一些接口可以查看springboot项目运行情况,只需要导入spring-boot-starter-actuator,项目集成:

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

二、监控api

几个api示例:

/autoconfig : 查看自动配置

/beans : 查看beans

为了安全起见,可以单独设置监控的端口和访问地址:

management.port=9000  # 通过9000端口访问

management.address=127.0.0.1 # 只允许本机访问

/shotdown : 关闭

打开shutdown功能:

endpoints:
shutdown:
enabled: true #启用shutdown
sensitive: false #禁用密码验证

执行完毕,启动的项目已被终止了。

安全设置,设置账号密码,只有拥有账号密码的才能shutdown

1、引用security

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

2、开启安全验证

endpoints:
shutdown:
enabled: true      #启用shutdown
sensitive: true     #开启shutdown的安全验证
path: /testshutdown   #指定shutdown endpoint的路径 management:
port: 9000        #指定管理端口
address: 127.0.0.1   #指定管理IP
security:
role: SUPERUSER #角色 security:
user:
name: admin #验证用户名
password: 123 #验证密码

3、postman请求shutdown

参考:Spring Boot Actuator监控端点小结

springboot 监控的更多相关文章

  1. springboot 监控 Actuator

    springboot 提供了对项目的监控功能. 1.首先添加依赖包 <!-- https://mvnrepository.com/artifact/org.springframework.boo ...

  2. Springboot监控之二:Spring Boot Admin对Springboot服务进行监控

    概述 Spring Boot 监控核心是 spring-boot-starter-actuator 依赖,增加依赖后, Spring Boot 会默认配置一些通用的监控,比如 jvm 监控.类加载.健 ...

  3. springboot监控

    springboot版本 <parent> <groupId>org.springframework.boot</groupId> <artifactId&g ...

  4. Springboot监控之一:SpringBoot四大神器之Actuator之3-springBoot的监控和管理--指标说明

    Spring Boot包含很多其他的特性,它们可以帮你监控和管理发布到生产环境的应用.你可以选择使用HTTP端点,JMX或远程shell(SSH或Telnet)来管理和监控应用.审计(Auditing ...

  5. Springboot监控之一:SpringBoot四大神器之Actuator

    介绍 Spring Boot有四大神器,分别是auto-configuration.starters.cli.actuator,本文主要讲actuator.actuator是spring boot提供 ...

  6. Grafana+Prometheus打造springboot监控平台

    1. 环境 springboot 1.5.10.RELEASE Grafana 5.4.2 Prometheus 2.6.0 jdk 1.8 2.通过micrometer与springboot应用和p ...

  7. SpringBoot 监控管理模块actuator没有权限的问题

    SpringBoot 1.5.9 版本加入actuator依赖后, 访问/beans 等敏感的信息时候报错,如下 Tue Mar 07 21:18:57 GMT+08:00 2017 There wa ...

  8. Springboot监控之一:SpringBoot四大神器之Actuator之2--springboot健康检查

    Health 信息是从 ApplicationContext 中所有的 HealthIndicator 的 Bean 中收集的, Spring Boot 内置了一些 HealthIndicator. ...

  9. Springboot监控之一:SpringBoot四大神器之Actuator之2--覆盖修改spring cloud的默认的consul健康检查规则

    微服务网关是socket长连接与支付公司对接,该网关需要提供http接口给内部系统调用,当socket没有建立连接时(网关服务的高可用是haProxy搭建的,有些服务的socket可能未连上支付公司) ...

随机推荐

  1. 自定义控件_水平滑动的View 自定义属性

    保持饥饿,保持愚蠢,我们对待事情本来应该就是这样的 接下来我要写一个水平滑动的自写义,实现效果 水平滑动我们有很多种实现方法,recyceryView,HorizontalScrollView都可以, ...

  2. spring基础---->spring自定义标签(一)

    Spring具有一个基于架构的扩展机制,可以使用xml文件定义和配置bean.本博客将介绍如何编写自定义XML bean的解析器,并用实例来加以说明.其实我一直相信 等你出现的时候我就知道是你. Sp ...

  3. [Android] 开源框架 Volley 自定义 Request

    今天在看Volley demo (https://github.com/smanikandan14/Volley-demo), 发现自定义GsonRequest那块代码不全, 在这里贴一个全的. pu ...

  4. css从中挖去一个圆

    始终居中: width: 300px; position: fixed; /*在可视区域的上下左右居中*/ top: calc(50vh - 200px); left: calc(50vw - 150 ...

  5. oracle11g安装完成后修改字符集

    author : headsen chen date:2018-05-10  10:27:16 oracle11g完成安装后,由于默认安装的时候无法指定字符集,所以手动修改字符集和10g版本一样的字符 ...

  6. CSS文本对齐text-align详解

    1.语法 text-align具体参数如下: 语法:text-align : left | right | center | justify 说明:设定元素内文本的水平对齐方式. 参数:left :  ...

  7. ipad4没有声音提示消息

    打开『设置』-『通用』-侧边开关用于: 1:锁定屏幕旋转 2:静音 √ 把对号去掉 选择1即可

  8. Spring的AOP-----HelloWord

    这里就一个计算器开发为例1搭建环境-搭配好Spring的AOP开发环境导入以下这些包:2建立好核心处理模块的类ArithmeticCalculator: package com.jeremy.spri ...

  9. PhoneGap在Mac环境下使用问题小结

    PhoneGap在Mac环境下使用问题小结1,问题一:在执行命令phonegap run ios出现“Cordova needs ios-sim version 1.7 or greater, you ...

  10. KDevelop使用笔记【中文教程】

    *师从官方文档: https://userbase.kde.org/KDevelop4/Manual/zh-cn https://docs.kde.org/trunk5/en/extragear-kd ...