springboot版本

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

监控类型

1.以json串的格式返回监控信息(spring-boot-starter-actuator)

2.以图形化界面的方式返回监控内容(spring-boot-admin-starter-server、spring-boot-admin-starter-client)

监控内容

spring-boot-starter-actuator(支持自定义)

如果使用springMVC还可以监控以下内容

spring-boot-admin

spring-boot-starter-actuator配置

pom.xml

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- 安全方面,可选配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>

application.yml

management:
# 是否启用认证
security:
enabled: false
# 监控端口
port: 8088
# 监控上下文路径
context-path: /monitor
# 启用shutdown,实现springboot项目优雅停机,要考虑安全问题,默认不启用
endpoints:
shutdown:
enabled: true
# 认证账号、密码,需要spring-boot-starter-security支持,可选配置
#security:
# user:
# name: wly
# password: wly
# role=SUPERUSER
# spring boot信息,可选配置
info:
app:
name: spring-boot-actuator-wly
version: 1.0.0

访问监控URL

http://localhost:8088/monitor/env

效果

 

spring-boot-admin配置

spring-boot-admin-starter-server配置,需要单独建立一个监控的项目

pom.xml

 <dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.6</version>
</dependency>

application.yml

server.port=8085

启动类(添加@EnableAdminServer注解)

package com.example.springbootadmin;

import de.codecentric.boot.admin.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication
@EnableAdminServer
public class SpringbootadminApplication { public static void main(String[] args) {
SpringApplication.run(SpringbootadminApplication.class, args);
}
}

配置完成启动项目即可~

spring-boot-admin-starter-client配置

pom.xml

<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.5.6</version>
</dependency>

application.yml

# 配置spring-boot-admin-starter-server的监控地址
spring:
boot:
admin:
url: http://localhost:8085
server:
port: 8080
management:
# 是否启用认证
security:
enabled: false

配置完成启动服务即可~

效果

访问spring-boot-admin-starter-server地址(localhost:8085)

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 监控

    一.什么是spring-boot-starter-actuator(doc) springboot项目如何检查配置与运行状态呢?官方提供了一些接口可以查看springboot项目运行情况,只需要导入s ...

  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. 使用NHibernate(1)--资料汇总

    NHibernate最新版本是4.0,目前还只是alpha版,没有发布.稳定版本是3.3,项目中用的也是这个版本,所以以后的介绍都是基于这个版本的. 在网上找了一下相关的学习资料,现汇总如下: NHi ...

  2. web服务器/应用服务器

    1.概念 Web服务器的基本功能就是提供Web信息浏览服务.它只需支持HTTP协议.HTML文档格式及URL.与客户端的网络浏览器配合.因为Web服务器主要支持的协议就是HTTP,所以通常情况下HTT ...

  3. python-五个面试题

    问题一:以下的代码的输出将是什么? 说出你的答案并解释. class Parent(object): x = 1 class Child1(Parent): pass class Child2(Par ...

  4. call()和apply()方法(切换上下文)

    call方法: 语法:call([thisObj[,arg1[, arg2[, [,.argN]]]]]) 定义:调用一个对象的一个方法,以另一个对象替换当前对象. apply方法: 语法:apply ...

  5. 群晖MyDS账号注册--实现使用QuickConnect外网访问

    最近公司拿了个NAS给我,让我把它配置好,之前没有接触过这个东西,上网一查,发现就是和去年很火的玩客云和斐讯天天链N1的功能一样,可以实现文件储存和文件共享. 设备型号:群晖DS214SE 系统版本: ...

  6. springboot主从数据库

    是从springmvc的思路上来做的,主要就是配置主.从DataSource,再继承AbstractRoutingDataSource,重写determineCurrentLookupKey方法,通过 ...

  7. 有关索引的DMV

    转自:http://www.cnblogs.com/CareySon/archive/2012/05/17/2505981.html#commentform 有关索引的DMV 1.查看那些被大量更新, ...

  8. vue仿京东省市区三级联动选择组件

    工作中需要一个盒京东购物车地址选择相似的一个省市区三级联动选择组件,google查了下都是下拉框形式的,于是自己写了一个,希望对使用vue开发项目的朋友有帮助,显示效果如下:使用vue2.0开发 ht ...

  9. MVC缓存(一)

    //OutputCache是设置缓存,参数Duration设置缓存的过期时间,OutputCache可以加到Controller上,也可以加到Action上,但是当Controller与Action都 ...

  10. api拆分(数据传递和接收的几种方式)

    传递方式一:对象转String 接收:String类型接收再转对象 传递方式二:Map 接收:Map 传递方式三:json(Map转json) 接收:String转Map 传递方式四:Map里放jso ...