Class DiskSpaceHealthCheck
- java.lang.Object
-
- io.helidon.health.checks.DiskSpaceHealthCheck
-
- All Implemented Interfaces:
HealthCheck
@Liveness @ApplicationScoped @BuiltInHealthCheck public final class DiskSpaceHealthCheck extends Object implements HealthCheck
A health check that verifies whether the server is running out of disk space. This health check will check whether the usage of the disk associated with a specific path exceeds a given threshold. If it does, then the health check will fail.Also, by default, it will check the root path
/. These defaults can be modified using the "helidon.health.diskSpace.path" property (default "."), and the "helidon.health.diskSpace.thresholdPercent" property (default 99.999, virtually 100). The threshold should be set to a percent, such as 50 for 50% or 99 for 99%. If disk usage exceeds this threshold, then the health check will fail.Unless ephemeral disk space is being used, it is often not sufficient to simply restart a server in the event that that health check fails.
This health check is automatically created and registered through CDI.
This health check can be referred to in properties as
diskSpace. So for example, to exclude this health check from being exposed, usehelidon.health.exclude: diskSpace.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDiskSpaceHealthCheck.BuilderFluent API builder forDiskSpaceHealthCheck.
-
Field Summary
Fields Modifier and Type Field Description static StringCONFIG_KEY_PATHConfiguration key for path, when configured through Microprofile config.static StringCONFIG_KEY_THRESHOLD_PERCENTConfiguration key for threshold percent, when configured through Microprofile config.static StringDEFAULT_PATHDefault path on the file system the health check will be executed for.static doubleDEFAULT_THRESHOLDDefault threshold percent, when this check starts reportingHealthCheckResponse.State.DOWN.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DiskSpaceHealthCheck.Builderbuilder()A new fluent API builder to configure this health check.HealthCheckResponsecall()static DiskSpaceHealthCheckcreate()Create a new disk space health check to use, using defaults for all configurable values.
-
-
-
Field Detail
-
DEFAULT_PATH
public static final String DEFAULT_PATH
Default path on the file system the health check will be executed for. If you need to check a different path (e.g. application runtime disks are not mounted the same directory as application path), useDiskSpaceHealthCheck.Builder.path(java.nio.file.Path). When running within a MicroProfile server, you can configure path using a configuration key "helidon.health.diskSpace.path" Defaults to "."- See Also:
- Constant Field Values
-
DEFAULT_THRESHOLD
public static final double DEFAULT_THRESHOLD
Default threshold percent, when this check starts reportingHealthCheckResponse.State.DOWN.- See Also:
- Constant Field Values
-
CONFIG_KEY_PATH
public static final String CONFIG_KEY_PATH
Configuration key for path, when configured through Microprofile config.- See Also:
- Constant Field Values
-
CONFIG_KEY_THRESHOLD_PERCENT
public static final String CONFIG_KEY_THRESHOLD_PERCENT
Configuration key for threshold percent, when configured through Microprofile config.- See Also:
- Constant Field Values
-
-
Method Detail
-
builder
public static DiskSpaceHealthCheck.Builder builder()
A new fluent API builder to configure this health check.- Returns:
- builder
-
create
public static DiskSpaceHealthCheck create()
Create a new disk space health check to use, using defaults for all configurable values.- Returns:
- a new health check to register with
HealthSupport.Builder.add(org.eclipse.microprofile.health.HealthCheck...) - See Also:
DEFAULT_PATH,DEFAULT_THRESHOLD
-
call
public HealthCheckResponse call()
- Specified by:
callin interfaceHealthCheck
-
-