I am setting up the spring boot admin using spring cloud. Now I have set up a stand alone eureka server and one spring boot admin and some spring boot apps as admin clients. If I don't set management.context-path for all the clients, everything works fine. But Now I need to monitor all clients(some with no management.context-path
, some with different management.context-path
s). I know that I should use the meta-data to achieve this, but after reading the relative docs, I still could get this done. Here are my configurations on client and admin sides.
Client side:
spring:
application:
instance_id: user
name: microservice-provider-user
management:
context-path: '/mgmt'
eureka:
client:
serviceUrl:
defaultZone: http://localhost:8761/eureka/
instance:
preferIpAddress: false
statusPageUrlPath: ${management.context-path}${endpoints.info.path:/info}
healthCheckUrlPath: ${management.context-path}${endpoints.health.path:/health}
metadata-map:
instanceId:
${spring.application.name}:${spring.application.instance_id:${random.value}}
Admin side:
spring:
application:
name: wahaha-admin
boot:
admin:
routes:
endpoints: env,metrics,trace,dump,jolokia,info,configprops,trace,logfile,refresh,flyway,liquibase,heapdump,hystrix.stream,turbine.stream
url: http://${HOST_NAME:localhost}:${server.port}
discovery:
converter.management-context-path: '/mgmt'
Questions:
spring.boot.admin.discovery.converter.management-context-path
to be /mgmt
, the value is the same as the client side and this only works fine if I set all the client apps with the same value, and this is impossible. How should I do to support different management.context-path
?PS: I did all of these on my local desktop not on any public cloud, and will move to the product env later(still not using public cloud).
On the client:
eureka:
instance:
metadata-map:
management.context-path: ${management.context-path}
As described in the docs:
If you want to customize the default conversion of services you can either add health.path, management.port and/or mangament.context-path entries to the services metadata.