Spring boot admin显示网关服务器关闭的状态

问题描述 投票:0回答:1

我正在开发一个微服务环境。它是由Spring Cloud开发的。

网关服务器由Zuul开发,并已通过X.509证书认证(相互认证)保护。

我使用spring boot admin监视微服务。

我已经将Spring Cloud Discovery用于我的应用程序,并且将DiscoveryClient添加到Spring Boot Admin Server:

@Configuration
@EnableAutoConfiguration
@EnableDiscoveryClient
@EnableAdminServer
public class ApiAdminServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(ApiAdminServerApplication.class, args);
    }
}

Spring启动管理属性:

management.endpoints.web.exposure.include=*
management.endpoint.health.show-details=ALWAYS
spring.security.user.name=admin
spring.security.user.password=password

服务发现属性:

management.endpoint.metrics.enabled=true
management.endpoints.web.exposure.include=*
management.endpoint.prometheus.enabled=true
management.metrics.export.prometheus.enabled=true
management.metrics.tags.application=${spring.application.name}

网关属性:

server.ssl.enabled=true
server.ssl.key-store-type=PKCS12
server.ssl.key-store=classpath:tls/keyStore.p12
server.ssl.key-store-password=changeit
server.ssl.trust-store=classpath:tls/trustStore.jks
server.ssl.trust-store-password=changeit
server.ssl.trust-store-type=JKS
server.ssl.client-auth=need

网关服务器在Spring Boot管理面板中显示为应用程序,但其状态为down。

我如何配置spring boot admin来监视https网关应用程序?

spring-cloud netflix-eureka netflix-zuul spring-boot-actuator spring-boot-admin
1个回答
0
投票

Spring Boot Admin调用/actuator/health端点以了解应用程序的运行状况。请检查此端点是否工作正常,否则,您可能需要根据需要进行配置。默认情况下,Spring检查此处提到的许多健康指标:

https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#auto-configured-healthindicators

您也可以配置自己的指标,文档中的摘录:

import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;

@Component
public class MyHealthIndicator implements HealthIndicator {

    @Override
    public Health health() {
        int errorCode = check(); // perform some specific health check
        if (errorCode != 0) {
            return Health.down().withDetail("Error Code", errorCode).build();
        }
        return Health.up().build();
    }

}
© www.soinside.com 2019 - 2024. All rights reserved.