相关文章推荐
幸福的麦片  ·  营销管理(第16版)_((美)菲利普·科特勒 ...·  1 年前    · 
斯文的香烟  ·  陆战“钢铁侠”精彩来袭- 解放军报- 中国军网·  1 年前    · 
呐喊的书签  ·  钢琴家_百度百科·  1 年前    · 
阳光的海豚  ·  生命学院颉伟课题组揭示早期胚胎先锋转录因子调 ...·  1 年前    · 
俊逸的杯子  ·  初中金属活动性顺序表_百度文库·  2 年前    · 
小百科  ›  How to Visualise Spring Boot Actuator Health Indicators in Spring Boot Admin | iO
discover
果断的闹钟
2 年前
Submit a RFP/RFI
  • business@iodigital.com
  • Change language

    Change region

  • What we do
    Marketing automation and email Content and inbound marketing Advertising and media Social media Marketplaces Discover all (+11)
    Web development, CMS, and DXP E-commerce Custom development & integrations Self-service portals Artificial intelligence Discover all (+11)
    Brand identity Activation Radio and television ads Campaign creation Branding Discover all (+7)
    Brand and communication strategy Employer branding Digital strategy Discover all (+7)
    Content and asset creation Video and motion Branded podcasts Discover all (+8)
    Data & Intelligence
    Auditing & Research
    HubSpot Google Marketing Platform Shopware Sitecore Drupal Storyblok Discover all (+25)
    Industries
  • Cases
  • Careers
    Jobs Your career Campus life
  • Insights
    Discover by topic:
    Strategy Technology Marketing Content & creation Agency news
    Discover by format:
    Blogs Dossiers Events & Webinars Videos Whitepapers
  • About us
    Campuses Press
    • What we do
      Marketing automation and email Content and inbound marketing Advertising and media Social media Marketplaces Discover all (+11)
      Web development, CMS, and DXP E-commerce Custom development & integrations Self-service portals Artificial intelligence Discover all (+11)
      Brand identity Activation Radio and television ads Campaign creation Branding Discover all (+7)
      Brand and communication strategy Employer branding Digital strategy Discover all (+7)
      Content and asset creation Video and motion Branded podcasts Discover all (+8)
      Data & Intelligence
      Auditing & Research
      HubSpot Google Marketing Platform Shopware Sitecore Drupal Storyblok Discover all (+25)
      Industries
    • Cases
    • Careers
      Overview Jobs Your career Campus life
    • Insights
      Discover by topic:
      Strategy Technology Marketing Content & creation Agency news
      Discover by format:
      Blogs Dossiers Events & Webinars Videos Whitepapers
    • About us
      Overview Campuses Press
    • Contact
    • Change language

      Change region

    1. Home
    2. History
    3. Foreach
    4. How to visualise spring boot actuator health indicators in spring boot admin

    How to Visualise Spring Boot Actuator Health Indicators in Spring Boot Admin

    The Spring Boot Admin project provides a user-friendly way to manage and monitor a Spring Boot application with very little effort.

    The Spring Boot Admin project provides a user-friendly way to manage and monitor a Spring Boot application with very little effort.

    Spring Boot Admin is a web application that helps you to monitor and manage a Spring Boot application. It can gather auditing, health and metric data. In this blogpost, we will first shed light on what a health indicator is and how to create a custom one. Next, we’re going to visualize our custom health indicator by means of Spring Boot Admin.

    Health indicator

    A Spring Boot Actuator Health Indicator provides health information of a Spring Boot Application. This health information is accessible at the /health endpoint and can be consumed by monitoring software. By default, multiple Health Indicators are auto-configured.

    Custom health indicator

    A custom health indicator can be defined by implementing the HealthIndicator interface. As an example, I created a BlogEnpointStatusHealthIndicator bean. This bean returns 2 values: “Health status” and “Up since”. The “Health status” property indicates whether our endpoint is up or not and the “Up Since” property indicates since when our endpoint has been up. These properties will automatically be added to the JSON of the /health endpoint:

    @Component
    public class BlogEndpointStatusHealthIndicator implements HealthIndicator {
    private BlogService blogService;
    @Override
    public Health health() {
        try {
            Health.Builder healthBuilder;
            healthBuilder = blogService.isBlogEndpointUp() ? Health.up() : Health.down();
            DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ISO_DATE_TIME;
            LocalDateTime availableSince = blogService.getAvailableSince();
            return healthBuilder.withDetail("up since", uptime.format(dateTimeFormatter))
                    .build();
        } catch (Exception e) {
            return Health.down(e).build();
    @Autowired
    public void setBlogService(BlogService blogService) {
        this.blogService = blogService;
    }

    Resulting JSON:

    {  
      "status":"UP",
      "blogEndpointStatus":{  
         "status":"UP",
         "up since":"2017-06-26T15:56:28.574"
      "diskSpace":{  
         "status":"UP",
         "total":497687719936,
         "free":201710972928,
         "threshold":10485760
    }
    Spring Boot Admin

    The Spring Boot Admin project simplifies the administration of Spring Boot applications by providing a simple user interface. In order to incorporate Spring Boot Admin into your application, you first need to set up a separate Spring Boot Admin server. This server will collect data from one or more Spring Boot Admin clients.

    Setup Spring Boot Admin Server

    To set up a Spring Boot Admin server, create a separate Spring Boot project. After your Spring Boot project has been created, add the following info to your pom.xml :

    <dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server</artifactId>
       <version>1.5.2</version>
    </dependency>
    <dependency>
    <groupId>de.codecentric</groupId>
    <artifactId>spring-boot-admin-server-ui</artifactId>
    <version>1.5.2</version>
    </dependency>

    Next, add the @EnableAdminServer annotation to your configuration. By defining this annotation, the application will automatically pull in the Spring Boot Admin Server configuration.

    @Configuration
    @EnableAutoConfiguration
    @EnableAdminServer
    public class SpringBootAdminApplication {
    public static void main(String[] args) {
        SpringApplication.run(SpringBootAdminApplication.class, args);
    }

    Finally, add the property management.security.enabled to your properties file. This property will disable the security on your Spring Boot Admin server endpoints (don’t use this in a production environment!). To secure your endpoints, look at how to Secure Spring Boot Admin : management.security.enabled=false

    Setup Spring Boot Admin Client

    To register an application to a Spring Boot Admin Server, you have to include the Spring Boot Admin Client project in your pom.xml :

    <dependency>
       <groupId>de.codecentric</groupId>
       <artifactId>spring-boot-admin-starter-client</artifactId>
    
     
    推荐文章
    幸福的麦片  ·  营销管理(第16版)_((美)菲利普·科特勒等)小说最新章节全文免费 ...
    1 年前
    斯文的香烟  ·  陆战“钢铁侠”精彩来袭- 解放军报- 中国军网
    1 年前
    呐喊的书签  ·  钢琴家_百度百科
    1 年前
    阳光的海豚  ·  生命学院颉伟课题组揭示早期胚胎先锋转录因子调控多能性程序的 ...
    1 年前
    俊逸的杯子  ·  初中金属活动性顺序表_百度文库
    2 年前
    今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
    删除内容请联系邮箱 2879853325@qq.com
    小百科 - 百科知识指南
    © 2024 ~ 沪ICP备11025650号