Spring Boot Admin Page

前端 未结 2 2061
暖寄归人
暖寄归人 2021-02-10 23:28

I am trying to understand how to use SBAP in my application because it is a very handy tool for development. I\'m reading their reference guide but I\'m not understanding a few

2条回答
  •  隐瞒了意图╮
    2021-02-10 23:48

    I don't think the recommendation is NOT to use Spring boot admin in production for monitoring, ofcourse, after you ensure that there is some level of security that is built in.

    The correct usage pattern for SBAP is to think about it as a standalone application that provides an aggregated view of all of your Springboot services via a GUI. Infact, as long as HEALTH/METRICS urls are exposed via ACTUATOR, the MONITORED services do not even need to be aware of the fact there is some application that is monitoring it's status.

    SBAP can PULL all METRICS from standard endpoints after it discovers your services from a Service Registry like EUREKA as that totally decouples SBAP from being statically aware of any service other than EUREKA itself. A sample YAML configuration and JAVA code is as follows

    @SpringBootApplication
    @EnableDiscoveryClient
    @EnableAdminServer
    public class SpringbootAdminApplication {
    
       public static void main(String[] args) {
          SpringApplication.run(SpringbootAdminApplication.class, args);
       }
    }
    

    bootstrap.yml

      eureka:
        instance:
           leaseRenewalIntervalInSeconds: 10
        client:
          registerWithEureka: false
          fetchRegistry: true
          serviceUrl:
            defaultZone: http://localhost:8761/eureka/
      spring:
        boot:
         admin:
           url: http://localhost:8080
        cloud:
          config:
            enabled: false
    

    With the 2 configurations above alone in a SpringBoot project,it would become a SBAP server that can be accessed via "http://localhost:8080" and monitor your services.

提交回复
热议问题