slothish1
slothish1

Reputation: 159

Having trouble implementing spring boot actuator custom health indicator

I've tried to follow the documentation, but I only see "status : UP" every time I check. I even went as far as to return Health.down.build() universally, but I still just see "status : UP". I'm not sure what I've done wrong. I have no errors.

Upvotes: 2

Views: 1689

Answers (1)

Martin Strube
Martin Strube

Reputation: 21

Your custom HealthIndicator is registered on the go if you add the @Component annotation to your class. If you then call the method actuator/health I guess you're getting the summarized status:

{"status":"DOWN"}

Just add this to your application.properties to see a detailed view of the HealthIndicator result:

management.endpoint.health.show-details=always

and you will get something like this:

{
"status": "DOWN",
"details": {
    "MyCustomHealthCheck": {
        "status": "DOWN",
        "details": {
            "remote.system.down": "There is something wrong with system XXX"
        }
    },
    "diskSpace": {
        "status": "UP",
        "details": {
            "total": 499963174912,
            "free": 434322321408,
            "threshold": 10485760
        }
    }
}

}

Upvotes: 2

Related Questions