In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces the example analysis of Spring boot monitoring, which is very detailed and has a certain reference value. Friends who are interested must finish it!
Monitored service configuration
There happens to be a spring-boot project locally, and it also relies on jolokia (mainly to expose JMX's mbean through HTTP)
Project configuration is also necessary.
Endpoints: enabled: true jmx: enabled: true jolokia: enabled: truemanagement: security: enabled: false
Visit URL to see if it is ok.
Http://localhost:8080/jolokia/read/org.springframework.boot:name=metricsEndpoint,type=Endpoint/Data
Set up a monitoring system
If you can see the data, there is no problem with the server configuration. How do we build Telegraf + InfluxDB + Grafana? these three components work together. Telegraf actually collects information. For example, visiting the above URL every 10 seconds to get metrics, the collected data is stored in InfluxDB, and then Grafana does data visualization.
But if manual installation is too troublesome, turn to the almighty github, find a great project (https://github.com/samuelebistoletti/docker-statsd-influxdb-grafana), directly fork and then modify some configuration to serve your own project. If you don't know the relevant configuration, you can run it directly, and then check it out through ssh.
Ssh root@localhost-p 22022
In terms of configuration, the main thing is to modify Telegraf, because it connects different projects, and what kind of information you need to collect, such as cpu,disk,net, etc., should be configured in Telegraf. For simplicity, I only set up three inputs.
# / etc/telegraf/telegraf.conf [[inputs.jolokia]] context = "/ jolokia" [[inputs.jolokia.servers]] name= "springbootapp" host = "{app ip address}" port = "8080" [[inputs.jolokia.metrics]] name= "metrics" mbean = "org.springframework.boot:name=metricsEndpoint,type=Endpoint" attribute = "Data" [inputs.jolokia.metrics]] name= "tomcat_max_threads" mbean = "Tomcat:name=\" http-nio-8080\ " Type=ThreadPool "attribute =" maxThreads "[[inputs.jolokia.metrics]] name=" tomcat_current_threads_busy "mbean =" Tomcat:name=\ "http-nio-8080\", type=ThreadPool "attribute =" currentThreadsBusy "
In fact, it is metrics of spring-boot standard and Threads of tomcat.
Restart the service / etc/init.d/telegraf restart after completion
View monitoring data
Let's visit InfluxDB to see if there is any data in http://localhost:3004/, and switch the database to Telegraf. Enter the following command to try
SHOW MEASUREMENTSSELECT * FROM jolokiaSELECT * FROM cpuSELECT * FROM memSELECT * FROM diskio
For example, enter SELECT * FROM jolokia to see what data spring-boot exposes, and you can see from the time column that Telegraf collects it every 10s, which is too frequent and stressful for server.
The above basically covers some metrics of cpu, memory and storage.
In fact, you can also configure network-related. If you are interested, you can see the official telegraf.conf, which contains examples of configuration [[inputs.net]].
Data visualization
With the data, the next step is visualization.
Enter http://localhost:3003/ as mentioned above in Github
Using the wizard click on Add data sourceChoose a name for the source and flag it as DefaultChoose InfluxDB as typeChoose direct as accessFill remaining fields as follows and click on Add without altering other fieldsUrl: http://localhost:8086Database: telegrafUser: telegrafPassword: telegraf
After adding the InfluxDB, create a new Dashboard, and then quickly ADD a few Graph.
To demonstrate, I added three, using the following three sets of query statements to render three charts
SELECT MEAN (usage_system) + MEAN (usage_user) AS cpu_total FROM cpu WHERE $timeFilter GROUP BY time ($interval) SELECT mean ("total") as "total" FROM "mem" WHERE $timeFilter GROUP BY time ($interval) fill (null) SELECT mean ("used") as "used" FROM "mem" WHERE $timeFilter GROUP BY time ($interval) fill (null) SELECT mean ("metrics_heap.used") as "heap_usage" FROM "jolokia" WHERE $WHERE ($) timeFilter GROUP BY time (interval)
The first is the CPU occupancy rate; the second is the memory usage, the green line is Total, the yellow line is Used;, the third is the use of jvm heap provided by jolokia, you can see the GC.
Just now also configured the collection of Tomcat, want to see the Thread of Tomcat is also appropriate.
SELECT mean ("tomcat_max_threads") FROM "jolokia" WHERE $timeFilter GROUP BY time ($interval) fill (null) SELECT mean ("tomcat_current_threads_busy") FROM "jolokia" WHERE $timeFilter GROUP BY time ($interval) fill (null)
The above is all the contents of the article "sample Analysis of Spring boot Monitoring". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.