How to Monitor Your KeyDB or Valkey Cache with Vigilmon
KeyDB (a high-performance Redis fork) and Valkey (the Linux Foundation's Redis fork) are popular in-memory data stores. If your application's caching layer goes down, it usually doesn't cause an immediate 500 error — but it causes cascading slowdowns as every request hits the database instead of the cache. This guide shows how to monitor your KeyDB or Valkey instance indirectly with Vigilmon.
Why You Can't Monitor KeyDB/Valkey Directly
KeyDB and Valkey use the Redis protocol over TCP (default port 6379) — not HTTP. Vigilmon monitors HTTP/HTTPS endpoints. So the right approach is to:
- Expose cache health via your application's health endpoint
- Monitor that HTTP endpoint with Vigilmon
Step 1: Add Cache Health to Your App's Health Endpoint
Node.js (ioredis)
import Redis from 'ioredis'
const redis = new Redis(process.env.REDIS_URL)
export async function GET() {
try {
await redis.ping() // Returns 'PONG'
return Response.json({ status: 'ok', cache: 'connected' })
} catch (error) {
// Return 503 to trigger Vigilmon alert
return Response.json(
{ status: 'error', cache: error.message },
{ status: 503 }
)
}
}
Python (redis-py)
import redis
from flask import Flask, jsonify
app = Flask(__name__)
r = redis.from_url(os.environ['REDIS_URL'])
@app.route('/health')
def health():
try:
r.ping()
return jsonify({'status': 'ok', 'cache': 'connected'})
except Exception as e:
return jsonify({'status': 'error', 'cache': str(e)}), 503
Laravel (PHP)
Route::get('/health', function () {
try {
Redis::ping();
return response()->json(['status' => 'ok', 'cache' => 'connected']);
} catch (Exception $e) {
return response()->json(['status' => 'error'], 503);
}
});
Step 2: Configure Vigilmon
- Sign up at vigilmon.online (free, no credit card)
- Add Monitor → enter your app's health endpoint
- Expected status: 200
- Enable multi-region consensus: 2+ regions confirm failure before alerting
- Check interval: 5 minutes (free) or 1 minute (paid)
Step 3: Distinguish Cache Failures from App Failures
For cleaner diagnostics, return component-level health:
{
"status": "degraded",
"components": {
"database": "ok",
"cache": "error",
"api": "ok"
}
}
Return 503 when any critical component is down, 200 with a degraded body when cache is down but the app can still function (cache-miss mode).
KeyDB vs Valkey: Monitoring Differences
Both KeyDB and Valkey are Redis-compatible, so the same monitoring approach works for both. The key difference:
- KeyDB: Multi-threaded Redis fork, usually self-hosted
- Valkey: Community fork post-Redis license change, increasingly used as Redis drop-in
Both use the same PING/PONG health check mechanism.
Self-Hosted Monitoring Tips
If you self-host KeyDB or Valkey, also configure:
# Check KeyDB/Valkey process health
redis-cli -p 6379 ping
# Should return: PONG
# Check memory usage
redis-cli info memory | grep used_memory_human
# Check connected clients
redis-cli info clients | grep connected_clients
Consider adding these to a cron job that updates a simple status file, then expose that file via HTTP for Vigilmon to check.
Failure Scenarios
| Failure | App Behavior | Vigilmon Response |
|---|---|---|
| KeyDB/Valkey crashes | Cache miss mode / slowdown | ✅ 503 if health check is strict |
| Memory exhausted | Keys evicted, degraded perf | ⚠️ Only if health checks memory |
| Connection refused | All cache ops fail | ✅ 503 via health endpoint |
| Network partition | Intermittent failures | ✅ Multi-region catches persistent failures |
Conclusion
KeyDB and Valkey can't be pinged over HTTP, but monitoring their impact on your application is straightforward:
- Add a cache ping to your
/healthendpoint - Return 503 if cache is down
- Point Vigilmon at that endpoint
With Vigilmon:
- ✅ Free tier, no credit card
- ✅ Multi-region consensus prevents false alerts
- ✅ Email + webhook notifications
Set up cache monitoring at vigilmon.online.
Top comments (0)