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. Mac OS 10.12使用SecureCRT 8.1.4无法保存密码的问题解决

    参考上图取消Use Keychain即可. 参考: https://jingyan.baidu.com/article/915fc414fda5fb51394b20bd.html

  2. Linux下which命令使用详解(转)

    我们经常在linux要查找某个文件,但不知道放在哪里了,可以使用下面的一些命令来搜索: which 查看可执行文件的位置. whereis 查看文件的位置. locate 配合数据库查看文件位置. f ...

  3. 异常捕获设置HTTPStatus

    第一步:创建一个异常类 package com.payease.exception; /** * @Created By liuxiaoming * @CreateTime 2017/12/12 下午 ...

  4. 【Maven学习】maven中依赖的配置详解

    根元素project下的dependencies可以包含一个或者多个dependency元素,以声明一个或多个项目依赖.每个依赖可以包含的元素有: groupId,artifactId和version ...

  5. mac环境下使用docker安装nginx

    前言 距离上一篇文章已经很长时间,近期实在事情太多了,也没来得及继续更新一些新的内容.现在开发使用的工作实在太多了,小编实在忍受不了windows那样卡机的状态,于是最近换了一个mac电脑,虽然做开发 ...

  6. linux mint 19安装 kvm 软件包

    1 我的处理器是2700x 首先安装cpu检测 sudo apt-get install cpu-checker 2 查看cpu内核 egrep -c '(vmx|svm)' /proc/cpuinf ...

  7. vue测试安装和配置

    npm install --save-dev @vue/test-utils mocha mocha-webpack npm install --save-dev jsdom jsdom-global ...

  8. Mac 安装tensorflow

    一. 安装 TensorFlow谷歌的官网和开源项目都有介绍各个系统的安装和使用(官网:https://www.tensorflow.org/install git: https://github.c ...

  9. 【很重要】优秀的常用的js库

    http://lodashjs.com/docs/   常用的各种工具库 sprintf  字符串格式 占位符替换等处理 devices.min.js

  10. [转]C#中Timer使用及解决重入问题

    本文转自:http://www.cnblogs.com/hdkn235/archive/2014/12/27/4187925.html ★前言 打开久违的Live Writer,又已经好久没写博客了, ...