ehcache is Java's most widely used in-memory caching framework — embedded in Spring applications via the Spring Cache abstraction, used as Hibernate's second-level cache, and deployed in JEE enterprise systems worldwide. Unlike standalone cache servers, ehcache runs inside your JVM, which means its health is inseparable from your application's health. Spring Boot Actuator exposes ehcache's state through dedicated health and metrics endpoints, giving Vigilmon a clean external window into cache availability, hit rates, and batch job execution. Vigilmon monitors these endpoints from the outside, catching cache degradation before it silently drives up database load.
What You'll Set Up
- Health endpoint monitor via Spring Boot Actuator
/actuator/health - Cache statistics availability check on
/actuator/caches - Cache hit rate monitoring via
/actuator/metrics/cache.gets - SSL certificate expiry alerts for HTTPS Spring Boot applications
- Heartbeat monitor for ehcache-dependent batch processing jobs
Prerequisites
- Spring Boot application with ehcache configured (
spring-boot-starter-cache+ehcachedependency) - Spring Boot Actuator enabled with health, caches, and metrics endpoints exposed
- A free Vigilmon account
Expose Required Actuator Endpoints
In application.properties or application.yml, ensure the necessary endpoints are exposed:
management.endpoints.web.exposure.include=health,caches,metrics
management.endpoint.health.show-details=always
Step 1: Monitor the Actuator Health Endpoint
Spring Boot Actuator's /actuator/health endpoint aggregates the health of all registered health indicators, including the CacheHealthIndicator for ehcache. A 200 OK with "status":"UP" means the application and all caches are healthy.
- Log in to vigilmon.online and click Add Monitor.
- Set Type to
HTTP / HTTPS. - Enter the URL:
https://YOUR_APP/actuator/health - Set Check interval to
2 minutes. - Set Expected HTTP status to
200. - Under Advanced, set Expected body contains to
"status":"UP". - Click Save.
When ehcache fails to initialize or the cache manager encounters a fatal error, the health indicator returns "status":"DOWN" and the endpoint returns HTTP 503 — both of which Vigilmon will catch.
Step 2: Check Cache Statistics Availability
The /actuator/caches endpoint lists all registered caches by name. A successful response confirms that Spring's cache manager is active, all configured caches are registered, and the CacheManager bean is healthy.
- Add Monitor →
HTTP / HTTPS. - URL:
https://YOUR_APP/actuator/caches - Set Expected HTTP status to
200. - Under Advanced, set Expected body contains to
"cacheManagers"(the top-level key in the JSON response). - Set Check interval to
5 minutes. - Click Save.
An empty cacheManagers object or a 404 indicates that the cache manager failed to start or the actuator endpoint is misconfigured — both of which result in every cache operation falling through directly to the database.
Step 3: Monitor Cache Hit Rate via Metrics Endpoint
The /actuator/metrics/cache.gets endpoint exposes the cumulative cache hit and miss counts. While Vigilmon doesn't perform arithmetic, you can check that the metrics endpoint is returning data — which confirms that cache operations are being recorded and the metrics subsystem is healthy.
- Add Monitor →
HTTP / HTTPS. - URL:
https://YOUR_APP/actuator/metrics/cache.gets - Set Expected HTTP status to
200. - Under Advanced, set Expected body contains to
"measurements"(the JSON key containing hit/miss counts). - Set Check interval to
5 minutes. - Click Save.
For more advanced cache hit rate monitoring, expose a custom /actuator/health contributor in your Spring application that returns DOWN when the cache hit rate drops below a configurable threshold — then Vigilmon's health endpoint check (Step 1) will catch degraded cache performance automatically.
Step 4: SSL Certificate Expiry Alerts
Spring Boot applications running over HTTPS have TLS certificates that need renewal. Whether you use Let's Encrypt, a corporate CA, or a cloud load balancer certificate, Vigilmon can alert you before the certificate expires and breaks client connections.
- Open the HTTP / HTTPS monitor from Step 1 (using your HTTPS URL).
- Enable Monitor SSL certificate.
- Set Alert when certificate expires in less than
14 days. - Click Save.
For applications deployed behind a load balancer (AWS ALB, GCP LB, nginx), the certificate is on the load balancer rather than the Spring Boot process — monitor the external HTTPS URL to check the certificate that users actually see.
Step 5: Heartbeat Monitor for ehcache-Dependent Batch Jobs
Spring Batch jobs that use ehcache for intermediate result caching (e.g., caching lookup tables or reference data between steps) are particularly vulnerable to silent cache failures. If ehcache fails mid-batch, steps complete but return degraded results — often without throwing an exception.
Set up a Vigilmon heartbeat to track batch job execution:
- In Vigilmon, Add Monitor →
Heartbeat. - Name it
Batch Job Health. - Set Expected interval based on your job schedule (e.g.
1 hourfor an hourly batch). - Copy the generated heartbeat ping URL.
In your Spring Batch job configuration, add a heartbeat ping as a JobExecutionListener:
@Component
public class VigilmonHeartbeatListener implements JobExecutionListener {
private final String heartbeatUrl = "YOUR_HEARTBEAT_URL";
@Override
public void afterJob(JobExecution jobExecution) {
if (jobExecution.getStatus() == BatchStatus.COMPLETED) {
try (var client = HttpClient.newHttpClient()) {
client.send(
HttpRequest.newBuilder(URI.create(heartbeatUrl)).GET().build(),
HttpResponse.BodyHandlers.discarding()
);
} catch (Exception ignored) {}
}
}
}
Register the listener on your job:
@Bean
public Job myBatchJob(JobRepository jobRepository, Step myStep) {
return new JobBuilder("myBatchJob", jobRepository)
.listener(vigilmonHeartbeatListener)
.start(myStep)
.build();
}
The heartbeat is only pinged on COMPLETED status — a FAILED or STOPPED job leaves Vigilmon's heartbeat window to expire, triggering an alert.
Step 6: Alert Channels and Grouping
- Go to Alert Channels in Vigilmon and configure your preferred channel (email, Slack, or PagerDuty).
- Group ehcache monitors under your application's service group alongside the main application health monitor.
- Set the
/actuator/healthmonitor with the highest alert priority — aDOWNstatus means the entire application is degraded, not just the cache layer. - Set Consecutive failures before alert to
2on the caches endpoint — Spring Boot context restarts can briefly make the endpoint unavailable during application restart.
Summary
| Monitor | Target | What It Catches |
|---|---|---|
| Actuator health | /actuator/health | CacheManager failure, application DOWN |
| Cache list | /actuator/caches | Missing cache registrations, manager startup failure |
| Cache metrics | /actuator/metrics/cache.gets | Metrics subsystem failure |
| SSL certificate | HTTPS app URL | Certificate expiry |
| Heartbeat | Batch job listener | Job failure, missed execution, cache-related batch errors |
ehcache failures don't announce themselves — they quietly degrade application performance by forcing every cache miss to hit the database directly. Vigilmon's external checks on Spring Boot Actuator endpoints give you the earliest possible signal that something has gone wrong in the cache layer, long before query latency spikes and SLA breaches make it obvious.