O'Reilly logo

Learning Spring Boot 2.0 - Second Edition by Greg L. Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Writing a custom health check

Another critical feature needed when we take our application to production is monitoring it. In the olden days, people would set up a CRON job to ping a server and see if it was up. More intricate systems would track disk usage, memory usage, and ideally page someone when the database was at 95%, so it could be saved before falling over.

Spring Boot provides a new era in health check monitoring. To kick things off, launch the application and visit /application/health:

    {
        status: "UP",
        diskSpace: {
            status: "UP",
            total: 498937626624,
            free: 96519303168,
            threshold: 10485760
        },
        mongo: {
            status: "UP",
            version: "3.4.6"
        }
    }  

Out of the box, this provides us with an endpoint we can ping and additionally, gives ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required