Spring Boot Actutaur + telegraf + InFluxDB + Grafana Build monitoring Platform

Source: Internet
Author: User
Tags grafana influxdb spring boot actuator


Complete a set of precise, beautiful graphical monitoring systems the first step from here




Telegraf is a proxy for collecting and reporting indicators and data


It is part of the tick stack and is a plugin-driven server proxy for collecting and reporting metrics. Telegraf has plug-ins or integrated features that get metrics directly from running systems , get metrics from third-party APIs, and even listen to metrics through STATSD and Kafka consumer Services . It also has an output plug-in that can send metrics to various other data stores , services and message queues , including Influxdb,graphite,opentsdb,datadog, LIBRATO,KAFKA,MQTT,NSQ and so on.











Spring Boot Actuator


Spring Boot Actuator includes a metric service with "metrics" and "gauge" support. "Gauge" records a single value; The ' counter ' records the increment (increment or decrement). Spring Boot Actuator also provides an PublicMetricsinterface that can be implemented to expose metrics that you cannot record through one of these two mechanisms. See SystemPublicMetricsan example.



Depending on the spring boot actuator package in your Springboot project, you will see that the mapped of the console becomes much more, such as/env,/health,/info, etc. Congratulations on your successful use of the metric program has been a simple monitoring, in the browser to enter the local IP project access address such as: Http://localhost:8080/metrics, the following data will appear



  


{
    "counter.status.200.root": 20,
    "counter.status.200.metrics": 3,
    "counter.status.200.star-star": 5,
    "counter.status.401.root": 4,
    "gauge.response.star-star": 6,
    "gauge.response.root": 2,
    "gauge.response.metrics": 3,
    "classes": 5808,
    "classes.loaded": 5808,
    "classes.unloaded": 0,
    "heap": 3728384,
    "heap.committed": 986624,
    "heap.init": 262144,
    "heap.used": 52765,
    "nonheap": 0,
    "nonheap.committed": 77568,
    "nonheap.init": 2496,
    "nonheap.used": 75826,
    "mem": 986624,
    "mem.free": 933858,
    "processors": 8,
    "threads": 15,
    "threads.daemon": 11,
    "threads.peak": 15,
    "threads.totalStarted": 42,
    "uptime": 494836,
    "instance.uptime": 489782,
    "datasource.primary.active": 5,
    "datasource.primary.usage": 0.25
}
Administrator Features


by specifying spring.application.admin.enabled Property to enable management-related features for your application . This exposes theSpringApplicationAdminMXBeanplatform MBeanServer . you can use this feature to remotely manage your Spring boot application. This can also be useful for any service wrapper implementation.


Introduce spring-boot-admin dependency
<dependency>
     <groupId> de.codecentric </ groupId>
     <artifactId> spring-boot-admin-server </ artifactId>
     <version> 1.4.0 </ version>
</ dependency>
  
<dependency>
     <groupId> de.codecentric </ groupId>
     <artifactId> spring-boot-admin-server-ui </ artifactId>
     <version> 1.4.0 </ version>
</ dependency>





  If you want to know which HTTP port the application is running on, use the key to get the property local.server.port.



Be careful when enabling this feature, because Mbean exposes methods for shutting down the application.


using Jolokia for jmx over HTTP


  Jolokia is a jmx-http bridge that provides another way to access jmx beans. to use Jolokia, simply add the dependencies org.jolokia:jolokia-core . For example, using Maven you can add the following:





<dependency> 
    <groupId> org.jolokia </ groupId> 
    <artifactId> jolokia-core </ artifactId> 
 </ dependency>


Configure the configuration of the response in Application.yaml latter application.properties


jolokia.config.debug=true  
endpoints.jolokia.enabled=true  
#endpoints.jolokia.sensitive=true  
endpoints.jolokia.path=/jolokia 
Environment construction


Download Telegraf, Influxdb, Grafana, I personally recommend to build a Windows version of the environment to configure their own play


Https://portal.influxdata.com/downloads#influxdb
Https://grafana.com/grafana/download?platform=windows





1 INFLUXDB Configuration



To modify the influxdb.conf, set the log file directory:


#cd to install the extracted modifications influxdb.conf


[Admin]
# Determines whether the Admin service is enabled.
Enabled = True



# The default bind address used by the Admin service.
bind-address = ": 8083"



Other configuration is the default good, do not modify, if the version download is not the same may need to modify, may wish to give me a message, I will reply in time



2 start



From the cmd Command window, switch to the INFLUXDB installation directory and execute the following command:



Influxd-config influxdb.conf



From the cmd Command window, switch to the TELEGRAF installation directory and execute the following command:



Telegraf-config telegraf.conf



Switch to the bin directory in the Grafana installation directory, double-click Grafana-server.exe Launcher



Access to http://locahost:8090, which is a configurable port number that can be accessed by:



Use:



To access http://localhost:8086, use Admin/admin to log on to the native Grafana and create a new INFLUXDB data source:






"Note" When the Telegraf is started, a TELEGRAF database is created by default when the data is escalated to INFLUXDB, so we configure database to be Telegraf



Click New to create a dashboards



The configuration editor will come out to configure the page:



Click General: Configure basic chart information



Click Metrics, configure the receipt information collected, the actual is to write SQL query, different database data SQL written in different ways



Looking at http://localhost:8083, you can find the default 4 measurements (table) in the Telegraf library:






After the panel in the configuration Grafana is complete, such a simple native monitoring system is built:









Spring Boot Actutaur + telegraf + InFluxDB + Grafana Build monitoring Platform


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.