Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Memo 2: Spring Boot Actuator+Prometheus+Grafana

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

One: Spring Boot Actuator

Spring-boot-actuator can monitor and manage applications as they are put into production. You can choose to use HTTP endpoints or JMX to manage and monitor applications

Introducing Spring-boot-actuator into Spring boot applications

Org.springframework.boot spring-boot-starter-actuator

3.application.yml file configuration

# managementmanagement: endpoints: web: exposure: include: "*" endpoint: health: show-details: ALWAYS

4.Spring Boot Actuator built-in Endpoints

Two: Prometheus

Add Micrometer Prometheus registration to the Spring Boot application.

Io.micrometer micrometer-registry-prometheus

2.Docker pulls Prometheus image

Docker pull prom/prometheus

3. Prometheus configuration file

# my global configglobal: scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. Evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. # scrape_timeout is set to the global default (10s). # Load rules once and periodically evaluate them according to the global 'evaluation_interval'.rule_files: #-"first_rules.yml" #-"second_rules.yml" # A scrape configuration containing exactly one endpoint to scrape:# Here it's Prometheus itself.scrape_configs: # The job name is added as a label `job= `to any timeseries scraped from this config. -job_name: 'prometheus' # metrics_path defaults to' / metrics' # scheme defaults to 'http'. Static_configs:-targets: ['127.0.0.1 job_name 9090']-job_name:' spring-actuator' metrics_path:'/ mybatis/actuator/prometheus' scrape_interval: 5s static_configs:-targets: ['112.74.105.178spring-actuator' metrics_path']

4. Run the Prometheus container

Docker run-d-- name=prometheus-p 9090V / mnt/demo/prometheus.yml:/etc/prometheus/prometheus.yml prom/prometheus-- config.file=/etc/prometheus/prometheus.yml

5. View the operation of Prometheus

Three: Grafana

Docker runs Grafana image

Docker run-d-- name=grafana-p 3000UR 3000 grafana/grafana

2. Grafana configure Prometheus data source

3. Monitoring dashboard

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report