Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot Actuator Health Returning DOWN

Tags:

spring-boot

When I access the /health endpoint from my Spring Boot application (1.2.4.RELEASE) it is returning a status of DOWN:

{
    status: "DOWN"
}

Are there any starter projects or libraries that are known to overwrite the status? Is there any other reason (besides writing a custom one) why it would return DOWN?

like image 507
Steve Avatar asked Jun 09 '15 15:06

Steve


People also ask

What does spring boot actuator health do?

Spring Boot Actuator module helps you monitor and manage your Spring Boot application by providing production-ready features like health check-up, auditing, metrics gathering, HTTP tracing etc. All of these features can be accessed over JMX or HTTP endpoints.

What does actuator health check do?

The Actuator module provides useful insight into the Spring environment for a running application with functions for health checking and metrics gathering by exposing multiple endpoints over HTTP and JMX.

Why is my actuator not working spring boot?

Spring Boot Actuator is not working because the spring boot actuator dependency is incorrect or the actuator isn't configured properly in the application. properties file. If the spring boot starter actuator is not configured, endpoints like health, info, shutdown, refresh, env, and metrics may not work.

How do I turn off my spring boot health indicator?

If you want to completely disable all health indicators available out of the box and instead provide your own health indicators, you can do so by setting property management. health. binders. enabled to false and then provide your own HealthIndicator beans in your application.


3 Answers

In your Spring properties, set endpoints.health.sensitive = false. The /health endpoint will then return the list of various health indicators and you can debug from there.

For a production environment you should enable security around the /health endpoint.

Edit

As Vincent pointed out below, you'll also need management.security.enabled = false if the health endpoint is secured, which seems to be the default in more recent versions of Spring Boot.

A common issue that I've seen with Spring Boot out of the box is that it auto-configures Solr, and without additional configuration the /health endpoint indicates that Solr is DOWN. An easy way to fix this is to disable the Solr auto configuration in your Application.java with this annotation: @SpringBootApplication(exclude={SolrAutoConfiguration.class})

like image 69
Paul F Avatar answered Oct 19 '22 22:10

Paul F


If the health url shows "DOWN" or HTTP 503 - Service Unavailable error, then try adding the below property in application.properties

URL - http://localhost:8080/actuator/health

management.endpoint.health.show-details=always

Now the url should show more than just DOWN. If Solr host is not reachable, then ignore the Solr check using the below exclusion -

@SpringBootApplication(exclude = { SolrAutoConfiguration.class })

Now the health should come up. The health check basically validates predefined health check internally (Example - DataSourceHealthIndicator, DiskSpaceHealthIndicator, CassandraHealthIndicator, etc).

If one of the health indicator is down, the health will be down and you can see the error as a response after adding the property mentioned above to application.properties.

like image 31
Arunchunaivendan Avatar answered Oct 19 '22 20:10

Arunchunaivendan


in my case, I needed both these properties to get more details :

endpoints.health.sensitive: false
management.security.enabled: false

Otherwise, all I was getting was an DOWN status.

I had an issue with RabbitMQ connection : my application is not using it yet, but we've started wiring some code related to it. The application works fine, but we were getting DOWN health status, which was quite puzzling : Spring Boot is surprisingly silent in the logs, as no error shows at startup (I'll probably need to change my config to make it more verbose)

like image 21
Vincent F Avatar answered Oct 19 '22 21:10

Vincent F