一、什么是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. 模拟http请求 带 chunked解析办法一

    今天在干坏事抓取别人页面时候遇到一个问题,平时我们在post数据后,大不了要求提交cookie,但是今天这个测试了N遍不需要coookie都行的,但是抓取到的始终是乱码,怎么解析都不行.于是自己又把c ...

  2. ERROR in [copy-webpack-plugin] unable to locate "D:/xxx/xxx/xxx"

    vue打包的时候npm run build报错 ERROR in [copy-webpack-plugin] unable to locate "D:/xxx/xxx/xxx" 这 ...

  3. Ubuntu 16.04 安装 Gnome 桌面环境

    个人博客链接:Ubuntu 16.04 安装 Gnome 桌面环境

  4. Ibatis的#和$的区别

    来自别人的:https://blog.csdn.net/findmyself_for_world/article/details/49976555 总结:凡是#的,都作为参数,用setobject方式 ...

  5. linux 配置svn服务器+使用+注意事项

    本文以ubuntu系统进行安装. 1.安装svn服务器 apt-get install subversion 输入 y 回车确认安装. 安装完毕后可以用 下边的命令查看是否安装完成,如果现实出版本号和 ...

  6. Python的一些教程(转)

    原文:http://blog.chinaunix.net/uid-26200547-id-3418038.html Python 安装配置及基本语法篇 Python 语言速成 Python 基本知识  ...

  7. python 将日期戳(五位数时间)转换为标准时间

    5位数日期戳 读取 .mat 文件处理里面数据时,发现里面的日期数据全部都是 “5位数” 数字,很不解: 后来查到可以在excel中通过设置单元格调回标准日期格式,如下: 选中日期戳,右键选择 “格式 ...

  8. ORM之基础操作进阶

    一.外键自关联(一对多) 1.建表 # 评论表 class Comment(models.Model): id = models.AutoField(primary_key=True) content ...

  9. 基于rman的坏块恢复

    转载请注明出处 http://blog.csdn.net/guoyjoe/article/details/30965303   实验过程例如以下: 1.使用rman备份全库 Recovery Mana ...

  10. C#建WindowForm调用R可视化

    众所周知R软件功能非常强大,可以很好的进行各类统计,并能输出图形.下面介绍一种R语言和C#进行通信的方法,并将R绘图结果显示到WinForm UI界面上的方法,文中介绍的很详细,需要的朋友可以参考下. ...