本案例使用Prometheus去追踪SpringBoot的Metrics信息,通过Grafana将Prometheus收集到的信息进行可视化展示。

使用的软件版本:

OS:Win10 x64 专业版

JDK1.8_181

Prometheus-2.0

Grafana-6.3.0

1.Prometheus 配置文件 如下所示

# my global config
global:scrape_interval:     15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. # 抓取target的时间间隔evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # 计算rules 的时间间隔# scrape_timeout is set to the global default (10s). # 抓取的超时时间# Alertmanager configuration
alerting:alertmanagers:- static_configs:- targets:# - alertmanager:9093# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:# - "first_rules.yml"# - "second_rules.yml"# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:- job_name: 'jvm-web'scrape_interval: 5sscrape_timeout: 5smetrics_path: '/actuator/prometheus'scheme: httpstatic_configs:- targets:- 127.0.0.1:8389  #此处填写 Spring Boot 应用的 IP + 端口号

2.创建一个Spring Boot程序,这里只放pom.xml中主要配置

 <dependencies><!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web --><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><version>2.1.4.RELEASE</version></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-test</artifactId><scope>test</scope><exclusions><exclusion><groupId>org.junit.vintage</groupId><artifactId>junit-vintag-engine</artifactId></exclusion><exclusion><groupId>junit</groupId><artifactId>junit</artifactId></exclusion></exclusions></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-actuator</artifactId></dependency><!--  micrometer核心包,桥接Prometheus --><dependency><groupId>io.micrometer</groupId><artifactId>micrometer-registry-prometheus</artifactId><version>1.2.0</version></dependency><!--  micrometer获取jvm相关信息,用于展示在Grafana上 --><dependency><groupId>io.github.mweirauch</groupId><artifactId>micrometer-jvm-extras</artifactId><version>0.1.4</version></dependency></dependencies><build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId><executions><execution><goals><goal>build-info</goal></goals></execution></executions></plugin><plugin><groupId>pl.project13.maven</groupId><artifactId>git-commit-id-plugin</artifactId><version>2.2.6</version><executions><execution><goals><goal>revision</goal></goals></execution></executions><configuration><dotGitDirectory>${project.basedir}/.git</dotGitDirectory></configuration></plugin></plugins></build>

3.启动Prometheus

windows版本只需要双击prometheus.exe即可。

验证地址:http://localhost:9090/

4.启动Grafana

验证地址:http://localhost:3000/

5.配置Grafanna数据源

使用Prometheus与Grafana追踪SpringBoot程序相关推荐

  1. springboot 应用:异常管理,应用启动过程,应用监控 Prometheus 和 Grafana

    异常管理 springboot 应用中默认的全局异常处理类是 BasicErrorController,内部判断 accept 如果是 text/html 则返回 /error 路径的模板:如果是 a ...

  2. 完整版SpringBoot集成Prometheus配置Grafana监控指标包括响应时间分位数TP90,TP80(图+文)

    1 缘起 监控作为线上服务管理的最重要一环, 每当新服务上线后,都需要监控上线服务运行情况,包括QPS.时延.成功响应率.内存和CPU使用情况等, 通过监控信息,清晰且及时地掌握当前服务的健康程度,以 ...

  3. Docker下Prometheus和Grafana三部曲之三:自定义监控项开发和配置

    本文是<Docker下Prometheus和Grafana三部曲>的终篇,前面的文章中,我们体验了快速搭建监控环境,也揭示了如何编排Docker容器来简化环境搭建过程,在监控系统中有个业务 ...

  4. Docker下Prometheus和Grafana三部曲之二:细说Docker编排

    本文是<Docker下Prometheus和Grafana三部曲>的第二篇,在上一章<Docker下Prometheus和Grafana三部曲之一:极速体验>中,我们只做了少量 ...

  5. 普罗米修斯监控系统_基于Prometheus和Grafana的监控平台 - 环境搭建

    导读 微服务中的监控分根据作用领域分为三大类,Logging,Tracing,Metrics. Logging - 用于记录离散的事件.例如,应用程序的调试信息或错误信息.它是我们诊断问题的依据.比如 ...

  6. Envoy service mesh、Prometheus和Grafana下的微服务监控(翻译)

    原文链接:medium.com/@dnivra26/m- 如果你刚接触"Service Mesh"和"Envoy",我这里有一篇文章可以帮你入门. 这是Envo ...

  7. 服务搭建篇(一) 搭建基于prometheus + node_exporter + grafana + Alertmanager 的监控报警系统 , 保姆级教程

    感兴趣的话大家可以关注一下公众号 : 猿人刘先生 , 欢迎大家一起学习 , 一起进步 , 一起来交流吧! 一. 介绍 1.Prometheus: 一个监控系统,集成在项目中可以对项目运行的一些情况进行 ...

  8. 【转载】incubator-dolphinscheduler 如何在不写任何新代码的情况下,能快速接入到prometheus和grafana中进行监控

    一.prometheus和grafana 简介 Prometheus 是继 Kubernetes 之后的第二个 CNCF "毕业" 项目,其监控理念传承于由谷歌研发的一款内部监控软 ...

  9. gpio引脚介绍 树莓派3b_使用微创联合M5S空气检测仪、树莓派3b+、prometheus、grafana实现空气质量持续监控告警WEB可视化...

    1.简介 使用微创联合M5S空气检测仪.树莓派3b+.prometheus.grafana实现空气质量持续监控告警WEB可视化 grafana dashboard效果: 2.背景 2.1 需求: 1. ...

最新文章

  1. 使用Visual Studio将Objective-C编译C++
  2. 最简单的Sublime插件开发教程
  3. DICOM文件格式与编程(转)
  4. python类中的函数_python类中的函数问题
  5. 关于数字证书理解的简单整理以及12306站点证书简单分析
  6. 汇编Ring 3下实现 HOOK API
  7. java jqgrid json格式_jqGrid 数据之 Json
  8. php代码加密 (php,decode)
  9. 美团最好战的那个男人要走了
  10. hive --metastore三种模式
  11. C++ map的基本和高级操作
  12. php_字符编码浅谈_积累中。。。
  13. 为什么不能说“接受原假设”?
  14. STM32的USART3(PC10,PC11)异常,USART3_TX(PC10)持续低电平(0V)
  15. linux内核编译及config配置
  16. css实现背景动态效果图
  17. 使用Word Embedding构造简洁有效的文本摘要系统
  18. 股市大涨该买吗?教你用算法量化交易行为!
  19. 微信小程序快速上手(学习笔记总结)
  20. 集合转换成数组的两种方法---toArray()和toArray(T[] a)

热门文章

  1. 线性回归 - 波斯顿房价预测
  2. 禁止乱用:一款牛批的开源去马赛克工具。。。
  3. java 解析/读取 种子/bt/torrent 内容
  4. 微信使用教程(微信怎么玩?微信公众平台教程)
  5. Redisson 3.7.x 版本报非法反射:WARNING: An illegal reflective access operation has occurred
  6. 爱做梦的人-人的特性之一
  7. 俄罗斯起草法案建议设立离岸公司交易加密货币
  8. Python统计西游记妖怪出场次数(使用jieba分词)
  9. 固态硬盘和机械硬盘的区别,全面对标谁是大腿
  10. 【HTML-5】小米耳机产品模块