SpringBootAdmin据说是把actuator暴露的信息综合展示出来,

给我的感觉就是一刀88级。

以下内容抄自Github上的官方文档--------2.0.5版本

3.客户端配置

3.1 展示版本信息

官网说如果是spring-boot程序,打包时加上如下代码,会自动生成META-INF/build-info.properties



<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>build-info</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

非spring-boot自己看官方文档

效果如下:

SpringBootAdmin小记

SpringBootAdmin小记

3.4 打标记

官方说可以用下面2种方式:

#using the metadata
spring.boot.admin.client.instance.metadata.tags.environment=test

#using the info endpoint
info.tags.environment="队长别开枪,是我"

但是,我测试了只有第2种有效,效果如下

SpringBootAdmin小记

SpringBootAdmin小记

3.5 Spring Boot Admin Client

3.5.1Spring Boot Admin Client 可选配置

属性名称 描述 默认值
spring.boot.admin.client.enabled 是否允许 Spring Boot Admin Client true
spring.boot.admin.client.url 强制让Spring Boot Admin Server 注册的URL,以逗号分隔  
spring.boot.admin.client.api-path 在admin server中注册的endpoint "instances"
spring.boot.admin.client.username
spring.boot.admin.client.password
SBA Server的授权用户和密码  
spring.boot.admin.client.period 反复注册的间隔(ms) 10,000
spring.boot.admin.client.connect-timeout 注册连接超时(ms) 5,000
spring.boot.admin.client.read-timeout 注册读取超时(ms) 5,000
spring.boot.admin.client.auto-registration 如果设置成true将会在client启动之后自动进行周期注册任务 true
spring.boot.admin.client.auto-deregistration 是否允许自动解除注册的开关,后面的英文看不懂=.=!

null

spring.boot.admin.client.register-once 如果设置为true,那么会按照spring.boot.admin.instance.url定义的顺序只注册在第一个Server上,如果注册的Server挂了,将会自动注册到下一个上,如果设置成false那么会注册在全部Server上 true
spring.boot.admin.client.instance.health-url Health-url to register with. Can be overridden in case the reachable URL is different (e.g. Docker). Must be unique in registry. management-url and endpoints.health.id.
spring.boot.admin.client.instance.management-base-url Base url for computing the management-url to register with. The path is inferred at runtime, and appended to the base url. Guessed based on management.port, service-url and server.servlet-path.
spring.boot.admin.client.instance.management-url Management-url to register with. Can be overridden in case the reachable url is different (e.g. Docker). Guessed based on management-base-url and management.context-path.
spring.boot.admin.client.instance.service-base-url Base url for computing the service-url to register with. The path is inferred at runtime, and appended to the base url. Guessed based on hostname, server.port.

spring.boot.admin.client.instance.service-url

服务的URL

Guessed based on service-base-url and server.context-path.

spring.boot.admin.client.instance.name

注册的名字

${spring.application.name:spring-boot-application}

spring.boot.admin.client.instance.prefer-ip

Use the ip-address rather then the hostname in the guessed urls. If server.address / management.address is set, it get used. Otherwise the IP address returned from InetAddress.getLocalHost() gets used.

false

spring.boot.admin.client.instance.metadata.*

与该实例 关联的元数据,以键值对的形式  

spring.boot.admin.client.instance.metadata.tags.*

与该实例 关联的标记,以键值对的形式

 

3.5.2 可选的实例元数据配置

Key Value Default value

user.name
user.password

Credentials being used to access the endpoints.

 

4 Spring Boot Admin Server

 Spring Boot Admin Server 可选配置

Property name Description Default value

spring.boot.admin.context-path

入口,与Dispatcher-Servlet.关联

 

spring.boot.admin.monitor.period

更新实例状态的时间间隔(ms)

10,000

spring.boot.admin.monitor.status-lifetime

实例状态的声明周期时间(ms),在没有过期之前,Server不会重新去检测

10,000

spring.boot.admin.monitor.connect-timeout

查询实例状态信息时连接超时时间(ms)

2,000

spring.boot.admin.monitor.read-timeout

查询实例状态信息时读取超时时间(ms)

20,000

spring.boot.admin.metadata-keys-to-sanitize

当元数据的key与这些正则匹配时,value将会被转换为json类型输出

".password$", ".*secret$", ".*key$", ".$token$", ".credentials.", ".*vcap_services$"

spring.boot.admin.probed-endpoints

For Spring Boot 1.x client applications SBA probes for the specified endpoints using an OPTIONS request. If the path differs from the id you can specify this as id:path (e.g. health:ping)..

"health", "env", "metrics", "httptrace:trace", "threaddump:dump", "jolokia", "info", "logfile", "refresh", "flyway", "liquibase", "heapdump", "loggers", "auditevents"

spring.boot.admin.instance-proxy.ignored-headers

当request请求时不进行传递d

`"Cookie", "Set-Cookie", "Authorization"

spring.boot.admin.ui.brand

首页的logo的url

"<img src="assets/img/icon-spring-boot-admin.svg"><span>Spring Boot Admin</span>"

spring.boot.admin.ui.title

首页展示的logo后面的文字

"Spring Boot Admin"

电灯泡

Spring Boot Admin will only update the info and available endpoints when a application changes status or when the registration changes. If you want to trigger an update with every new deployment, you can add a key value pair that changes with every restart (e.g. eureka.instance.metadata-map.startup: ${random.int}).

当一个实例状态改变或者注册改变的时候,Spring Boot Admin 仅仅只会更新信息和有效的endpoints ,如果你想要每次重新部署时触发一次更新,那么你可以添加一个每次重启都会变动的键值对,例如:eureka.instance.metadata-map.startup: ${random.int}

4.1.3. Converting ServiceInstances

Table 4. Instance metadata options

Key Value Default value

user.name
user.password

Credentials being used to access the endpoints.

 

management.address

替代服务的url, 作为健康监控端点入口地址

 

management.port

替代服务的port, 作为健康监控端点入口端口  

management.context-path

追加到服务路径后面的路径,用于获取监控

${spring.boot.admin.discovery.converter.mangement-context-path}

health.path

The path is appended to the service URL and will be used for the health-checking. Ignored by the EurekaServiceInstanceConverter.

${spring.boot.admin.discovery.converter.health-endpoint}

Table 5. Discovery configuration options

Property name Description Default value

spring.boot.admin.discovery.enabled

Enables the DiscoveryClient-support for the admin server.

true

spring.boot.admin.discovery.converter.management-context-path

Will be appended to the service-url of the discovered service when the management-url is converted by the DefaultServiceInstanceConverter.

/actuator

spring.boot.admin.discovery.converter.health-endpoint-path

Will be appended to the management-url of the discovered service when the health-url is converted by the DefaultServiceInstanceConverter.

"health"

spring.boot.admin.discovery.ignored-services

当使用服务发现时不会被注册的服务,可以用简单匹配

"foo*", "*bar", "foo*bar*"

 

spring.boot.admin.discovery.services

当使用服务发现时可以注册的服务

"*"

 

相关文章:

  • 2021-12-06
  • 2022-01-14
  • 2022-02-15
  • 2023-02-10
  • 2021-06-16
猜你喜欢
  • 2022-12-23
  • 2021-08-27
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
  • 2021-07-11
相关资源
相似解决方案