通过之前的文章我们使用Prometheus监控了应用服务器node_exporter,数据库mysqld_exporter,今天我们来监控一下你的应用。(本文以SpringBoot 2.1.9.RELEASE 作为监控目标)

编码

添加依赖

使用Prometheus监控SpringBoot应用只需要在pom文件添加如下两个依赖:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>

修改配置

修改application.properties或者application.yml文件,对外暴露监控端点

spring.application.name = blog
management.endpoints.web.exposure.include = prometheus
management.metrics.tags.application = ${spring.application.name}

启动应用

访问http://localhost:50378/actuator/查看开放端点

访问http://localhost:50378/actuator/prometheus查看Metrics

之前的文章中都是监控一个实例,这次咱们把端口设置成随机,启动两个实例,等下看看监控效果。

监控配置

Prometheus

修改prometheus.yml,增加监控任务

  - job_name: 'SpringBoot'
    metrics_path: '/actuator/prometheus'
    static_configs:
    - targets: ['10.1.61.10:50378','10.1.61.10:50822']

重启Prometheus,查看监控状态。

Grafana

直接从grafana官网寻找JVM监控DashBoard,然后导入到Grafana中(在环境搭建篇中已经讲述了操作过程,这里就不再赘述)。

查看效果


彩蛋

我们关掉其中一个SpringBoot实例,等2分钟,然后邮箱会收到这样一封告警邮件

怎么实现的呢?咱们下期有缘再见!


相关文章

使用Prometheus监控SpringBoot应用的更多相关文章

  1. Prometheus+Grafana监控SpringBoot

    Prometheus+Grafana监控SpringBoot 一.Prometheus监控SpringBoot 1.1 pom.xml添加依赖 1.2 修改application.yml配置文件 1. ...

  2. SpringBoot使用prometheus监控

    本文介绍SpringBoot如何使用Prometheus配合Grafana监控. 1.关于Prometheus Prometheus是一个根据应用的metrics来进行监控的开源工具.相信很多工程都在 ...

  3. Prometheus + Grafana 监控SpringBoot应用

      一.用到的工具 Prometheus Grafana Micrometer Grafana Dashboard (4701)   二.安装和运行Prometheus 官网下载prometheus- ...

  4. 【Springboot】用Prometheus+Grafana监控Springboot应用

    1 简介 项目越做越发觉得,任何一个系统上线,运维监控都太重要了.关于Springboot微服务的监控,之前写过[Springboot]用Springboot Admin监控你的微服务应用,这个方案可 ...

  5. Grafana+Prometheus打造springboot监控平台

    1. 环境 springboot 1.5.10.RELEASE Grafana 5.4.2 Prometheus 2.6.0 jdk 1.8 2.通过micrometer与springboot应用和p ...

  6. SpringCloud使用Prometheus监控(基于Eureka)

    本文介绍SpringCloud使用Prometheus,基于Eureka服务发现. 1.Prometheus介绍 在之前写过两篇有关Prometheus使用的文章,如下: <SpringBoot ...

  7. Prometheus 监控报警系统 AlertManager 之邮件告警

    转载自:https://cloud.tencent.com/developer/article/1486483 文章目录1.Prometheus & AlertManager 介绍2.环境.软 ...

  8. prometheus监控系统

    关于Prometheus Prometheus是一套开源的监控系统,它将所有信息都存储为时间序列数据:因此实现一种Profiling监控方式,实时分析系统运行的状态.执行时间.调用次数等,以找到系统的 ...

  9. Kubernetes集群部署史上最详细(二)Prometheus监控Kubernetes集群

    使用Prometheus监控Kubernetes集群 监控方面Grafana采用YUM安装通过服务形式运行,部署在Master上,而Prometheus则通过POD运行,Grafana通过使用Prom ...

随机推荐

  1. Hbase 统计表行数的3种方式总结

    有些时候需要我们去统计某一个Hbase表的行数,由于hbase本身不支持SQL语言,只能通过其他方式实现.可以通过一下几种方式实现hbase表的行数统计工作: 1.count命令 最直接的方式是在hb ...

  2. 关于纯xmlhttprequest请求服务器数据

    今天我们的web技术已经相当的完善, 各种前端框架如jquery或者再深一点的工具APIcloud 的使用极大的方便了我们的开发工作. 今天我要分享一个纯javascript的方式来解决请求服务器数据 ...

  3. Java第二次作业第三题

    四叶玫瑰线的图形设计:当用鼠标拖拽改变窗口大小时,四叶玫瑰线会重新绘制 package naizi; import java.awt.*; import java.awt.event.*; impor ...

  4. tomcat 中无法添加项目等问题的解决方案

    博客地址:http://www.moonxy.com 一.前言 今天新建了一个 maven 项目,添加程序文件之后,发现无法添加项目,然后修改配置,将应用添加到了 tomcat,启动时又报错,解决出现 ...

  5. PTA A1001&A1002

    从今天起每天刷1-2题PAT甲级 第一天 A1001 A+B Format (20 分) 题目内容 Calculate a+b and output the sum in standard forma ...

  6. 【linux】【jenkins】自动化部署一 安装jenkins及Jenkins工作目录迁移

    系统环境:Centos7 https://jenkins.io/zh/download/ 下载对应系统的jenkins 一.安装jdk8.0 jenkins安装需要jdk8or11,根据jenkins ...

  7. css超出多行隐藏

      单行隐藏: overflow: hidden;/*超出部分隐藏*/ text-overflow:ellipsis;/* 超出部分显示省略号 */ white-space: nowrap;/*规定段 ...

  8. Django-中间件-csrf扩展请求伪造拦截中间件-Django Auth模块使用-效仿 django 中间件配置实现功能插拔式效果-09

    目录 昨日补充:将自己写的 login_auth 装饰装在 CBV 上 django 中间件 django 请求生命周期 ***** 默认中间件及其大概方法组成 中间件的执行顺序 自定义中间件探究不同 ...

  9. Flume系列二之案例实战

    Flume案例实战 写在前面 通过前面一篇文章http://blog.csdn.net/liuge36/article/details/78589505的介绍我们已经知道flume到底是什么?flum ...

  10. Spring boot 官网学习笔记 - Configuration Class(@import)

    推荐使用 Java-based configuration ,也可以使用xml we generally recommend that your primary source be a single ...