In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about how to carry out visual monitoring of Spring Boot applications. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.
Brief introduction of picture and text
Logical relation
Effect demonstration
Quick start 1. Spring Boot App exposure Monitoring indicator [version 1.5.7.RELEASE]
First, add the following dependencies:
Org.springframework.boot spring-boot-starter-actuator io.prometheus simpleclient_spring_boot 0.0.26
Then, add the following note to the startup class Application.java:
@ SpringBootApplication@EnablePrometheusEndpoint@EnableSpringBootMetricsCollectorpublic class Application {public static void main (String [] args) {SpringApplication.run (Application.class, args);}}
Finally, configure the default login account and password in application.yml:
Security: user: name: user password: pwd
Tip: configuration of management.security.enabled: false is not recommended
After starting the application, you will see the following series of Mappings
Mappings
Using the account password to access http://localhost:8080/application/prometheus, you can see the metric data in Prometheus format.
Index data
2. Prometheus collects Spring Boot index data.
First, get the Docker image of Prometheus:
$docker pull prom/prometheus
Then, write the configuration file prometheus.yml:
Global: scrape_interval: 10s scrape_timeout: 10s evaluation_interval: 10mscrape_configs:-job_name: spring-boot scrape_interval: 5s scrape_timeout: 5s metrics_path: / application/prometheus scheme: http basic_auth: username: user password: pwd static_configs:-targets:-127.0.0.1 scrape_timeout 8080 # fill in the IP + port number of the Spring Boot application here
Next, start Prometheus:
$docker run-d\-- name prometheus\-p 9090 pwd 9090\-m 500m\-v "$(pwd) / prometheus.yml": / prometheus.yml\-v "$(pwd) / data": / data\ prom/prometheus\-config.file=/prometheus.yml\-log.level=info
Finally, visit http://localhost:9090/targets to check whether the Spring Boot collection status is normal.
Collection state
3. Grafana visual monitoring data
First, get the Docker image of Grafana:
$docker pull grafana/grafana
Then, start Grafana:
$docker run-- name grafana-d-p 3000 grafana/grafana
Next, access the http://localhost:3000/ configuration Prometheus data source:
Grafana login account admin password admin
Configure DataSource
Finally, configure a visual monitoring panel for a single metric:
Select Graph
Editing
Configure metrics to be monitored
Tip: you can't fill in anything here, you can only fill in the existing indicator points, which can be found on the home page of Prometheus, that is, http://localhost:9090/graph.
Index
After configuring a few more metrics, you can have the following effects:
Grafana monitoring interface
The above is what the editor shares with you on how to visually monitor Spring Boot applications. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are 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.