diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java index 293c44b6177..e8c0f5ab4a1 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/health/DiskSpaceHealthIndicator.java @@ -16,6 +16,8 @@ package org.springframework.boot.actuate.health; +import java.io.File; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -45,7 +47,8 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator { @Override protected void doHealthCheck(Health.Builder builder) throws Exception { - long diskFreeInBytes = this.properties.getPath().getFreeSpace(); + File path = this.properties.getPath(); + long diskFreeInBytes = path.getFreeSpace(); if (diskFreeInBytes >= this.properties.getThreshold()) { builder.up(); } @@ -55,7 +58,8 @@ public class DiskSpaceHealthIndicator extends AbstractHealthIndicator { this.properties.getThreshold())); builder.down(); } - builder.withDetail("free", diskFreeInBytes).withDetail("threshold", - this.properties.getThreshold()); + builder.withDetail("total", path.getTotalSpace()) + .withDetail("free", diskFreeInBytes) + .withDetail("threshold", this.properties.getThreshold()); } }