# Modern application metrics monitoring with JMX
A simple mix and aggregation of JMX, Jolokia, Telegraf, InfluxDB and Grafana tools, for Spring Boot and Actuator metrics monitoring.
## Background
Spring Boot Actuator has no out-of-box tooling for near real-time monitoring charts of gauges and counters metrics at `/metrics` HTTP endpoint. The official documentation current (1.4.1) offers some alternatives to export data in a [custom way for different platforms](http://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-metrics.html), but one have to implement by their own the data exportation and parsing.
On the other hand, Spring Boot [recommends you to use Jolokia] (http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#production-ready-jolokia) as a managed dependency, to expose internal's JMX MBeans through HTTP. This gives us the required implementation to explore and inspect performance metrics.
Additionally, [Spring Boot Admin] (https://github.com/codecentric/spring-boot-admin) offers JMX MBeans inspection support and you can use it to get some data snapshots about JMX use, but it is individual instance oriented. In a clustered Spring Boot environment, getting individual and isolated data from hosts may not be productive neither conclusive.
NewRelic and other APM tools gives the same result as we are trying to find out here, by instrumenting code with JVM layers, but data retention and long time-window may be a problem (if you need to inspect performance in terms of seconds or if you have to host old date data.
Others initiatives with the same goal, and custom code:
- https://github.com/sensu-plugins/sensu-plugins-springboot
- https://github.com/jimmidyson/spring-boot-prometheus
Just for consideration, installing and using StatsD and Graphite grants several hours of work, leaving out some great productivity-friendly alternatives, as Docker and Docker Compose tooling does.
## Main goal
Getting Spring Boot Actuator monitoring for self-service dashboards and chats, with modern and on-premise operations tooling, by using only out-of-box Spring Boot features and integrations, without any custom code.
This repository is a proposal to enable Spring Boot monitoring without 3rd-party problems of data retention and transformation, as NewRelic or Datadog does.
The result is achieved by the the flow:
- Spring Boot get exposed by Actuator
- Jolokia exposes MBeans through HTTP endpoint
- Telegraf pull Joloklia endpoints, fetching data and send it to InfluxDB
- InfluxDB stores time-series data
- Grafana connects to InfluxDB instance
- Grafana draws beautiful monitoring dashboards.
## Solution
1. Configured your Spring Boot instances with [Jolokia](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#production-ready-jolokia) dependency
2. Configure an instance of [Telegraf](https://github.com/influxdata/telegraf) tool for collecting metric along side with you application module instance. We do recommend installing one Telegraf instance per application node, making it isolated, since Telegraf requires the IP assigned to application instance. Using a central point of Telegraf, in a dynamic and provisioned environment may cause data interruption (since you have to updates the monitored IPs). Telegraf uses ~10mb of memory per instance, giving a small footprint to monitor applications instances.
3. Configure [Telegraf input](https://github.com/influxdata/telegraf/tree/master/plugins/inputs/jolokia) plugin for Jolokia
4. Configure [Telegraf output](https://github.com/influxdata/telegraf/tree/master/plugins/outputs/influxdb) plugin for InfluxDB.
5. Configure an instance of InfluxDB for data ingestion and storage.
6. Configure an instance of Grafana and a Datasource for data collecting.
7. Create your beautiful dashboards.
## This repo
This repository was organized as an example of a configuration with all tools for just monitoring, based on docker-compose structure.
`orderfy-config/telegraf.conf`: is an example of monitoring applications modules from [Orderfy](https://github.com/brunosimioni/orderfy) repository, but can be used with any Spring Boot Jolokia-powered repository.
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
Java SSM项目是一种使用Java语言和SSM框架(Spring + Spring MVC + MyBatis)开发的Web应用程序。SSM是一种常用的Java开发框架组合,它结合了Spring框架、Spring MVC框架和MyBatis框架的优点,能够快速构建可靠、高效的企业级应用。 1. Spring框架:Spring是一个轻量级的Java开发框架,提供了丰富的功能和模块,用于开发企业级应用。它包括IoC(Inverse of Control,控制反转)容器、AOP(Aspect-Oriented Programming,面向切面编程)等特性,可以简化开发过程、提高代码的可维护性和可测试性。 2. Spring MVC框架:Spring MVC是基于Spring框架的Web框架,用于开发Web应用程序。它采用MVC(Model-View-Controller,模型-视图-控制器)的架构模式,将应用程序分为模型层、视图层和控制器层,提供了处理请求、渲染视图和管理流程的功能。 3. MyBatis框架:MyBatis是一个持久层框架,用于与数据库进行交互。它提供了一种将数据库操作与Java对象映射起来的方式,避免了手动编写繁琐的SQL语句,并提供了事务管理和缓存等功能,简化了数据库访问的过程
资源推荐
资源详情
资源评论
收起资源包目录
JMX、Jolokia、Telegraf、InfluxDB和Grafana工具的简单组合,用于Spring Boot和执行器指标监控(95分以上课程大作业).zip (19个子文件)
application-metrics-monitoring-master
telegraf.conf.tmpl 65KB
docker-compose.yml 712B
init.sh 162B
telegraf-httpjson-docker-metrics-glue
pom.xml 2KB
src
test
java
glue
DockerConnectorApplicationTests.java 330B
main
resources
static
index.html 79B
bootstrap.yml 47B
java
glue
usecases
GenerateConfigurationUseCase.java 2KB
controllers
TelegrafConfigController.java 826B
GlueApplication.java 376B
entities
TelegrafConfiguration.java 223B
DockerConfiguration.java 405B
repositories
DockerRepository.java 914B
README.md 756B
.gitignore 61B
orderfy-config
grafana-conf.cmd 222B
telegraf.conf 436B
datasource.json 150B
README.md 4KB
共 19 条
- 1
资源评论
若明天不见
- 粉丝: 1w+
- 资源: 273
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功