Reputation: 17893
I am running boot admin server with eureka discovery.
Admin Server:
plugins {
id 'org.springframework.boot' version '2.1.7.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
ext {
set('springCloudVersion', "Greenwich.SR2")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
implementation 'de.codecentric:spring-boot-admin-starter-server:2.1.6'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
Admin Server Application Yml:
spring:
boot.admin.discovery.converter.management-context-path: /admin
application:
name: spring-boot-admin-sample-eureka
eureka: #<1>
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /admin/health
metadata-map:
startup: ${random.int} #needed to trigger info and endpoint update after restart
management.context-path: ${management.endpoints.web.base-path}
info.path: ${management.endpoints.web.base-path}/info
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/
management:
endpoints:
web:
exposure:
include: "*" #<2>
endpoint:
health:
show-details: ALWAYS
Client:
plugins {
id 'org.springframework.boot' version '2.1.7.RELEASE'
id 'io.spring.dependency-management' version '1.0.8.RELEASE'
id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
ext {
set('springCloudVersion', "Greenwich.SR2")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.cloud:spring-cloud-starter-netflix-eureka-client'
// https://mvnrepository.com/artifact/org.jolokia/jolokia-core
compile group: 'org.jolokia', name: 'jolokia-core', version: '1.6.2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
}
dependencyManagement {
imports {
mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}"
}
}
Application Yml
server:
port: 8083
servlet:
context-path: /mypath
#management config
eureka:
instance:
leaseRenewalIntervalInSeconds: 10
health-check-url-path: /admin/health
statusPageUrlPath: /admin/info
metadata-map:
startup: ${random.int} #needed to trigger info and endpoint update after restart
management.context-path: ${management.endpoints.web.base-path}
info.path: ${management.endpoints.web.base-path}/info
client:
registryFetchIntervalSeconds: 5
serviceUrl:
defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/
management:
endpoint:
health:
show-details: ALWAYS
endpoints:
web:
base-path: /admin
exposure:
include: '*'
security.basic.enabled: false
info:
component: Processor2
build:
name: Processor2
description: Processor to Roll up PP
version: 1
eureka:
region: ${eureka.client.region}
zone: ${eureka.instance.metadataMap.zone}
us-east-1b: discovery1
us-east-1c: discovery2
us-east-1e: discovery3
dp:
username: admin
password: admin123
spring:
application.name: procerssor2
jmx:
enabled: true
boot:
admin:
client:
instance:
service-url: /mypath
health:
config:
enabled: false
Due to the context path the boot admin is just displaying the details. I verified the http://localhost:8080/applications. It looks like below.
{
"name": "PROCERSSOR2",
"buildVersion": null,
"status": "UP",
"statusTimestamp": "2019-08-28T18:32:19.854Z",
"instances": [
{
"id": "804f35b9b73d",
"version": 1,
"registration": {
"name": "PROCERSSOR2",
"managementUrl": "http://192.168.0.8:8083/admin",
"healthUrl": "http://192.168.0.8:8083/mypath/admin/health",
"serviceUrl": "http://192.168.0.8:8083/",
"source": "discovery",
"metadata": {
"management.context-path": "/admin",
"startup": "-518261604",
"management.port": "8083",
"info.path": "/admin/info"
}
},
"registered": true,
"statusInfo": {
"status": "UP",
"details": {
"hystrix": {
"status": "UP"
},
"diskSpace": {
"status": "UP",
"details": {
"total": 499963170816,
"free": 366424887296,
"threshold": 10485760
}
},
"refreshScope": {
"status": "UP"
},
"discoveryComposite": {
"status": "UP",
"details": {
"discoveryClient": {
"status": "UP",
"details": {
"services": [
"procerssor2",
"spring-boot-admin-sample-eureka"
]
}
},
"eureka": {
"description": "Remote status from Eureka server",
"status": "UP",
"details": {
"applications": {
"PROCERSSOR2": 1,
"SPRING-BOOT-ADMIN-SAMPLE-EUREKA": 1
}
}
}
}
}
}
},
"statusTimestamp": "2019-08-28T18:32:19.854Z",
"info": {},
"endpoints": [
{
"id": "health",
"url": "http://192.168.0.8:8083/mypath/admin/health"
}
],
"buildVersion": null,
"tags": {}
}
]
}
when I remove the context path. everything work good. Please help
Upvotes: 1
Views: 2998
Reputation: 41
I had the same problem. At my case I only point eureka.instance.metadata-map.management.context-path
at ${service.servlet.context-path}/actuator
server:
port: ${service.auth-service.port}
servlet:
context-path: ${service.auth-service.context-path}
eureka.instance.metadata-map.management.context-path: ${service.servlet.context-path}/actuator
So I think according to your code it should be something like /admin/actuator
Upvotes: 3