List of usage examples for org.springframework.boot.actuate.health Health.Builder down
public static Builder down()
From source file:com.github.lburgazzoli.camel.boot.ApplicationHealthIndicator.java
@Override protected void doHealthCheck(Health.Builder builder) throws Exception { final long visits = controller.getVisits(); if (visits <= configuration.getMaxVisits()) { builder.up().withDetail("visitCount", visits).withDetail("visitMax", configuration.getMaxVisits()); } else {/*from www .j a va 2s .c o m*/ builder.down().withDetail("visitCount", visits).withDetail("visitMax", configuration.getMaxVisits()); } }
From source file:com.netflix.spinnaker.fiat.config.ResourceProvidersHealthIndicator.java
@Override protected void doHealthCheck(Health.Builder builder) throws Exception { boolean isDown = false; for (HealthTrackable provider : providers) { builder.withDetail(provider.getClass().getSimpleName(), provider.getHealthTracker().getHealthView()); isDown = isDown || !provider.getHealthTracker().isProviderHealthy(); }/* ww w. j a v a 2 s . c o m*/ if (isDown) { if (previousHealthCheckIsUp.getAndSet(false)) { log.warn("Server is now UNHEALTHY"); } builder.down(); } else { if (!previousHealthCheckIsUp.getAndSet(true)) { log.info("Server is now HEALTHY. Hooray!"); } builder.up(); } }
From source file:com.netflix.spinnaker.echo.pipelinetriggers.health.MonitoredPollerHealth.java
private void polledRecently(Health.Builder builder) { Instant lastPollTimestamp = poller.getLastPollTimestamp(); if (lastPollTimestamp == null) { builder.unknown();/* w ww . j a va2 s .c o m*/ } else { val timeSinceLastPoll = Duration.between(lastPollTimestamp, now()); builder.withDetail("last.polled", formatDurationWords(timeSinceLastPoll.toMillis(), true, true) + " ago"); builder.withDetail("last.polled.at", ISO_LOCAL_DATE_TIME.format(lastPollTimestamp.atZone(ZoneId.systemDefault()))); if (timeSinceLastPoll.compareTo(Duration.of(poller.getPollingIntervalSeconds() * 2, SECONDS)) <= 0) { builder.up(); } else { builder.down(); } } }
From source file:org.springframework.boot.actuate.health.DiskSpaceHealthIndicator.java
@Override protected void doHealthCheck(Health.Builder builder) throws Exception { File path = this.properties.getPath(); long diskFreeInBytes = path.getFreeSpace(); if (diskFreeInBytes >= this.properties.getThreshold()) { builder.up();/*w ww. jav a 2 s .c om*/ } else { logger.warn( String.format("Free disk space below threshold. " + "Available: %d bytes (threshold: %d bytes)", diskFreeInBytes, this.properties.getThreshold())); builder.down(); } builder.withDetail("total", path.getTotalSpace()).withDetail("free", diskFreeInBytes) .withDetail("threshold", this.properties.getThreshold()); }
From source file:org.springframework.boot.actuate.system.DiskSpaceHealthIndicator.java
@Override protected void doHealthCheck(Health.Builder builder) throws Exception { long diskFreeInBytes = this.path.getUsableSpace(); if (diskFreeInBytes >= this.threshold) { builder.up();// ww w. ja va 2 s. c o m } else { logger.warn( String.format("Free disk space below threshold. " + "Available: %d bytes (threshold: %d bytes)", diskFreeInBytes, this.threshold)); builder.down(); } builder.withDetail("total", this.path.getTotalSpace()).withDetail("free", diskFreeInBytes) .withDetail("threshold", this.threshold); }