图文简介

快速开始

1、Spring Boot 应用暴露监控指标【版本 1.5.7.RELEASE】

首先,添加依赖如下依赖:

<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency><groupId>io.prometheus</groupId><artifactId>simpleclient_spring_boot</artifactId><version>0.0.26</version></dependency>复制代码

然后,在启动类 Application.java 添加如下注解:

@SpringBootApplication
@EnablePrometheusEndpoint
@EnableSpringBootMetricsCollector
public class Application {public static void main(String[] args) {SpringApplication.run(Application.class, args);}}复制代码

最后,配置默认的登录账号和密码,在 application.yml 中:

security:user:name: userpassword: pwd复制代码

提示:不建议配置 management.security.enabled: false

启动应用程序后,会看到如下一系列的 Mappings

利用账号密码访问 http://localhost:8080/application/prometheus ,可以看到 Prometheus 格式的指标数据

2、Prometheus 采集 Spring Boot 指标数据

首先,获取 Prometheus 的 Docker 镜像:

$ docker pull prom/prometheus复制代码

然后,编写配置文件 prometheus.yml

global:scrape_interval: 10sscrape_timeout: 10sevaluation_interval: 10m
scrape_configs:- job_name: spring-bootscrape_interval: 5sscrape_timeout: 5smetrics_path: /application/prometheusscheme: httpbasic_auth:username: userpassword: pwdstatic_configs:- targets:- 127.0.0.1:8080  #此处填写 Spring Boot 应用的 IP + 端口号复制代码

接着,启动 Prometheus :

$ docker run -d
--name prometheus
-p 9090:9090
-m 500M
-v "$(pwd)/prometheus.yml":/prometheus.yml
-v "$(pwd)/data":/data
prom/prometheus
-config.file=/prometheus.yml
-log.level=info复制代码

最后,访问 http://localhost:9090/targets , 检查 Spring Boot 采集状态是否正常。

3、Grafana 可视化监控数据

首先,获取 Grafana 的 Docker 镜像:

$ docker pull grafana/grafana复制代码

然后,启动 Grafana:

$ docker run --name grafana -d -p 3000:3000 grafana/grafana复制代码

接着,访问 http://localhost:3000/ 配置 Prometheus 数据源:

Grafana 登录账号 admin 密码 admin

最后,配置单个指标的可视化监控面板:

提示,此处不能任意填写,只能填已有的指标点,具体的可以在 Prometheus 的首页看到,即 http://localhost:9090/graph

多配置几个指标之后,即可有如下效果:

spring boot security ajax_Spring-Boot-应用可视化监控相关推荐

  1. spring boot security ajax_Spring 和 SpringBoot 之间到底有啥区别?

    来源:uee.me/cNDC8 概述 对于 Spring和 SpringBoot到底有什么区别,我听到了很多答案,刚开始迈入学习 SpringBoot的我当时也是一头雾水,随着经验的积累.我慢慢理解了 ...

  2. 快来试试 Spring Boot 应用可视化监控,一目了然!

    点击上方蓝色"方志朋",选择"设为星标"回复"666"获取独家整理的学习资料! 作者:你照亮了我的世界 blog.csdn.net/weix ...

  3. Spring Boot + Security + MyBatis + Thymeleaf + Activiti 快速开发平台项目

    项目介绍 Spring Boot + Security + MyBatis + Thymeleaf + Activiti 快速开发平台 基于 Layui 的后台管理系统模板,扩展 Layui 原生 U ...

  4. Spring Boot Admin:微服务应用监控

    摘要 Spring Boot Admin 可以对SpringBoot应用的各项指标进行监控,可以作为微服务架构中的监控中心来使用,本文将对其用法进行详细介绍. Spring Boot Admin 简介 ...

  5. Spring Boot + Security + Thymeleaf + Activiti 快速开发平台项目

    点击关注公众号,实用技术文章及时了解 项目介绍 Spring Boot + Security + MyBatis + Thymeleaf + Activiti 快速开发平台 基于 Layui 的后台管 ...

  6. Spring Boot + Security + MyBatis + Thymeleaf + Activiti 快速开发平台

    前言 项目介绍 Spring Boot + Security + MyBatis + Thymeleaf + Activiti 快速开发平台 基于Layui的后台管理系统模板,扩展Layui原生UI样 ...

  7. SpringBootAdmin集成Turbine、使用Spring Boot Security添加安全验证

    SpringBootAdmin集成Turbine Hystrix Dashboard是一个监控熔断器状况的组件,而Turbine是一个可以聚合多个HystrixDashboard的组件.在Spring ...

  8. spring boot security学习

    spring boot security(一) 配置认证和授权 通过继承WebSecurityConfigurerAdapter,可以重写其认证和授权的逻辑. @Configuration @Enab ...

  9. boke练习: spring boot: security post数据时,要么关闭crst,要么添加隐藏域

    spring boot: security post数据时,要么关闭crst,要么添加隐藏域 http.csrf().disable(); 或者: <input name="${_cs ...

最新文章

  1. 专栏 | 基于 Jupyter 的特征工程手册:特征选择(四)
  2. arduino使用oled代码_Arduino提高篇06—温湿度OLED显示
  3. Linux-网络配置
  4. WPF Application启动界面设置——
  5. mysql批量插入数据的函数和存储过程
  6. win10宽带连接断网自动重连
  7. Ubuntu truffle框架安装
  8. oracle10g 如何打开,oracle10g  oem无法打开解决方法
  9. java的睡眠方式有几种_java的几种定时任务
  10. python转换函数使用_Python基础学习之时间转换函数用法详解
  11. 升级到AppCompat v22.1.0,现在获得IllegalArgumentException:AppCompat不支持当前的主题功能
  12. 计算机组成原理第三版第四章,计算机组成原理第四章答案
  13. Python smtp拟人个性化群发邮件,imap退信批量处理和SuiteCRM结合使用问题
  14. “史上最贵”卡塔尔世界杯,有哪些炫酷的“黑科技”?
  15. 中学计算机课注意事项,教育信息技术在初中物理课堂教学中的优点与注意事项...
  16. Building Maintainable Software-java篇之Couple Architecture Components Loosely
  17. 当世事再没完美可远在岁月如歌中找你
  18. java用for打印正方形_Java程序为给定的整数打印正方形图案
  19. 城市英语词汇(zt)
  20. Python函数及变量详解

热门文章

  1. Linux Shell 中各种括号的作用 ()、(())、[]、[[]]、{}
  2. c/c++处理命令行参数int argc, char **argv的方法
  3. oracle发邮件没有反应,[数据库]Oracle发邮件,权限问题
  4. 用户需求说明书_「软件项目管理入门」(21) 需求调研和需求分析怎么做?
  5. python tkinter载入图片_Python的GUI编程
  6. Python函数详解:函数定义、调用,lambda函数,高阶函数map,filter,reduce,函数式编程,模块化设计、代码复用、函数递归、enumerate()
  7. Hadoop之YARN介绍
  8. 滚动插件jQuery Marquee
  9. php mvc登陆注册,Asp.Net MVC 5使用Identity之简单的注册和登陆
  10. 正则表达式 python3_python3正则表达式总结