一、什么是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. ios 的EditBox点击空白处不隐藏的解决方案

    原因:参数少了前缀CC 解决方案:修改 cocos/platform/ios/CCEAGLView-ios.mm 中的 handleTouchesAfterKeyboardShow -(void) h ...

  2. phpcms V9内容页调用标签

    1.页面标题:{$title} 2.发表时间:{$inputtime} 3.内容来源:{$copyfrom} 4.文章内容:{$content} 5.缩略图地址:{$thumb} 6.组图列表: {l ...

  3. 打开wamp中的phpmyadmin出现403的错误

    安装完wamp后打开其下的phpMyAdmin也就是路径 http://localhost/phpmyadmin/ 如果端口不是 80 要加下端口,比如我是 8888 ,所以我的地址是:http:// ...

  4. 关于VFS文件系统中的superblock、inode、d_entry和file数据结构

  5. Python爬虫实例(一)爬取百度贴吧帖子中的图片

    程序功能说明:爬取百度贴吧帖子中的图片,用户输入贴吧名称和要爬取的起始和终止页数即可进行爬取. 思路分析: 一.指定贴吧url的获取 例如我们进入秦时明月吧,提取并分析其有效url如下 http:// ...

  6. 【转】通过ionice和nice降低shell脚本运行的优先级

    对于一些运行时会造成系统满载的脚本, 例如数据库备份, 会影响当时其他服务的响应速度, 可以通过ionice和nice对其IO优先级和CPU优先级进行调整例如降低"/usr/local/bi ...

  7. Poloniex API 文档

    Examples PHP wrapper by compcentral: http://pastebin.com/iuezwGRZ Python wrapper by oipminer: http:/ ...

  8. ubuntu 编辑pdf

    参考:https://www.2cto.com/kf/201710/689121.html Ubuntu下几个功能比较全面的PDF编辑工具. 1.flpsed flpsed是一个WYSIWYG的“伪” ...

  9. 介绍importlib

    Python将importlib作为标准库提供.它旨在提供Pythonimport语法和(__import__()函数)的实现.另外,importlib提供了开发者可以创建自己的对象(即importe ...

  10. 2018 又一个假期 over 了

    五一假期三天  在家窝三天  早上起床仍感觉没休息好  其实确实没休息好  假期的时间总不愿意拿来补觉用.周末准备去体检,真心恐惧医院的味道,硬着头皮还得上啊.