Reputation: 25
I am trying to monitor my spring-boot application using spring-boot-admin server, but it is saying that all the instances are down.
Admin Server pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.solution</groupId>
<artifactId>adminServer</artifactId>
<version>1.0.0</version>
<name>adminServer</name>
<description>Admin server for Solution Portal</description>
<properties>
<java.version>1.8</java.version>
<spring-boot-admin.version>2.3.1</spring-boot-admin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-dependencies</artifactId>
<version>${spring-boot-admin.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Admin Server application.properties
server.port = 3031
spring.boot.admin.server.url = http://localhost:8080#Customize UI
spring.application.name=Solution-Portal-Admin-Server
spring.boot.admin.ui.title = Portal Monitoring
spring.boot.admin.ui.brand = Rent Control
Admin server console error log
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.4.0)
2021-03-18 12:45:07.746 INFO 1944 --- [ main] c.s.adminServer.AdminServerApplication : Starting AdminServerApplication using Java 1.8.0_231 on SARATHI with PID 1944 (D:\PROJECT\workspace\adminServer\target\classes started by NIC-6 (Sarathi) in D:\PROJECT\workspace\adminServer)
2021-03-18 12:45:07.762 INFO 1944 --- [ main] c.s.adminServer.AdminServerApplication : No active profile set, falling back to default profiles: default
2021-03-18 12:45:08.849 INFO 1944 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 3031 (http)
2021-03-18 12:45:08.866 INFO 1944 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-03-18 12:45:08.866 INFO 1944 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.39]
2021-03-18 12:45:09.011 INFO 1944 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-03-18 12:45:09.011 INFO 1944 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1218 ms
2021-03-18 12:45:09.393 INFO 1944 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-03-18 12:45:09.534 WARN 1944 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)
2021-03-18 12:45:09.994 INFO 1944 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2021-03-18 12:45:10.026 INFO 1944 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 3031 (http) with context path ''
2021-03-18 12:45:10.044 INFO 1944 --- [ main] c.s.adminServer.AdminServerApplication : Started AdminServerApplication in 2.599 seconds (JVM running for 2.981)
2021-03-18 12:45:10.317 INFO 1944 --- [nio-3031-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2021-03-18 12:45:10.317 INFO 1944 --- [nio-3031-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2021-03-18 12:45:10.319 INFO 1944 --- [nio-3031-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 2 ms
2021-03-18 12:45:20.612 INFO 1944 --- [ parallel-4] d.c.b.a.server.services.StatusUpdater : Couldn't retrieve status for Instance(id=403c064424bb, version=0, registration=Registration(name=solution-portal, managementUrl=http://SARATHI:3030/actuator, healthUrl=http://SARATHI:3030/actuator/health, serviceUrl=http://SARATHI:3030/, source=http-api), registered=true, statusInfo=StatusInfo(status=UNKNOWN, details={}), statusTimestamp=2021-03-18T07:15:10.549Z, info=Info(values={}), endpoints=Endpoints(endpoints={health=Endpoint(id=health, url=http://SARATHI:3030/actuator/health)}), buildVersion=null, tags=Tags(values={}))
java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 10000ms in 'map' (and no fallback has been configured)
at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:294) ~[reactor-core-3.4.0.jar:3.4.0]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ Request to GET health [DefaultWebClient]
Stack trace:
at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.handleTimeout(FluxTimeout.java:294) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.publisher.FluxTimeout$TimeoutMainSubscriber.doTimeout(FluxTimeout.java:279) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.publisher.FluxTimeout$TimeoutTimeoutSubscriber.onNext(FluxTimeout.java:418) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.publisher.FluxOnErrorResume$ResumeSubscriber.onNext(FluxOnErrorResume.java:79) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.publisher.MonoDelay$MonoDelayRunnable.run(MonoDelay.java:119) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) ~[reactor-core-3.4.0.jar:3.4.0]
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) ~[reactor-core-3.4.0.jar:3.4.0]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[na:1.8.0_231]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_231]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) ~[na:1.8.0_231]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[na:1.8.0_231]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[na:1.8.0_231]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_231]
Client application pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>com.rent</groupId>
<artifactId>rentMngWithAdmin</artifactId>
<version>1.0</version>
<name>e-Rent</name>
<description>Rent Contol office managemant project</description>
<packaging>jar</packaging>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.4.0</version>
</dependency>
<!-- validation -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.validator</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.13</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Client application application.properties
spring.application.name=solution-portal
#============ custom paths ==============#
app.fileWebServiceURL=http://10.173.53.170:3453//
server.port=3030
spring.datasource.url=jdbc:postgresql://10.173.53.170:5432/RentControlDB
spring.datasource.username=postgres
spring.datasource.password=******
# Hibernate ddl auto (create, create-drop, validate, update)
spring.jpa.hibernate.ddl-auto = update
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
################ set file max size ######################
# Max file size.
spring.servlet.multipart.max-file-size=50MB
# Max request size.
spring.servlet.multipart.max-request-size=51MB
############# logging ###############
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
logging.level.org.springframework.web=info
logging.file.name=solution-portal.log
allowed.origin=http://localhost:4200
spring.boot.admin.client.url=http://localhost:3031
management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=always
Response from my client application for http://localhost:3030/actuator/health
{
"status": "UP",
"components": {
"db": {
"status": "UP",
"details": {
"database": "PostgreSQL",
"validationQuery": "isValid()"
}
},
"diskSpace": {
"status": "UP",
"details": {
"total": 144703483904,
"free": 95233036288,
"threshold": 10485760,
"exists": true
}
},
"ping": {
"status": "UP"
}
}
}
Please help me with this. Thanks in advance :)
Upvotes: 1
Views: 5064
Reputation: 36
In my case client hostname was transformed to public IP not accessible locally. So preferring IP address in client registration helped:
spring.boot.admin.client.instance.prefer-ip=true
Upvotes: 2