当前位置: 首页 > 知识库问答 >
问题:

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

越胤
2023-03-14

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

我已经在我的应用程序中使用了Spring Cloud Discovery,并在Spring Boot Admin Server中添加了一个DiscoveryClient:

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

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

Spring Boot管理属性:

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管理来监视https网关应用程序?

共有1个答案

姜志
2023-03-14

Spring Boot Admin调用/actuator/healthendpoint以了解应用程序的运行状况。请检查此endpoint是否正常工作,否则,您可能需要根据您的需求对其进行配置。默认情况下,对这里提到的一些健康指标进行Spring检查:

https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#auto-configure-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();
    }

}
 类似资料:
  • 问题内容: 我是Web服务的新手。我想获得一个使用PHP的Web服务的良好教程和示例。请向我建议一些网站,以简单的方式解释这些事情。 谢谢… 问题答案: 以下是一些帮助您入门的链接: http://davidwalsh.name/web-service-php-mysql-xml- json http://www.ibm.com/developerworks/opensource/tutorial

  • 这是我第一次尝试android服务,所以我有点迷茫。我正在开发一个应用程序,需要一个服务在后台运行的所有时间。此服务是从主活动中的onclick事件初始化的。要启动服务,我使用以下代码: 在服务中,我基本上有两件事。在onCreate方法中,我初始化一个计时器,每隔30分钟它就打开一个新线程,并检查服务器是否有任何新数据。在onStart方法上,我注册了一个接收器。 谢谢

  • 我正在开发一个应用程序,不断地从Kafka主题中读取数据。这些数据是字符串格式的,然后我将其写入xml文件 要编写这些文件,我使用执行服务。 我想知道什么时候应该关闭我的执行服务。如果我的应用程序是有时间限制的,我会在executor实例上使用它,但我的应用程序应该持续运行。 如果发生任何异常,我的整个应用程序被杀死,它会自动关闭我的执行者吗?或者我应该捕获一个未检查的异常并关闭我的执行器,就像我

  • 我有一个声明为Spring托管服务的自定义注释: 但是,有些服务的bean定义在中。将添加到这些bean中,可以启用Autowiring并通过xml文件注入dependecy。

  • 问题内容: 这是我正在使用的简单网络服务器 除了保持活力外,效果很好。当第一个请求进入时,被调用。但是过程并没有结束。实际上,TCP连接仍处于打开状态,这允许另一个请求通过,这是我试图避免的。 如何关闭现有的保持活动连接? 问题答案: 您可以调用响应回调。这将关闭请求连接。 由于没有什么可做的,它也将结束您的过程,最终结果与在那里进行调用相同。

  • 错误:传输错误202:绑定失败:地址已在使用错误:JDWP传输dt_socket初始化失败,TRANSPORT_INIT(510)JDWP退出错误AGENT_ERROR_TRANSPORT_INIT(197):未初始化传输[debuginit.c:750]本机方法中的致命错误:JDWP未初始化传输,jvmtierror=AGENT_ERROR_TRANSPORT_INIT(197) 知道吗?