Why Redis Health Monitoring is Essential
Redis is the most popular in-memory data store, used for caching, session management, message queues, and real-time analytics. Because Redis holds data in memory, it is both incredibly fast and uniquely vulnerable β a memory limit breach can cause data eviction or even server crashes. An RDB save failure means your data is not persisted to disk. A broken replication link means your failover will not work when you need it most.
Standard Redis monitoring relies on the INFO command output, but parsing this text output and setting appropriate thresholds requires significant effort. dargslan-redis-health connects to your Redis server, collects all health metrics, and provides actionable alerts based on industry-standard thresholds.
Install dargslan-redis-health
pip install dargslan-redis-health
Zero dependencies. Uses raw Redis protocol over TCP sockets β no redis-py library needed.
CLI Usage
# Full health report
dargslan-redis report
# Memory usage details
dargslan-redis memory
# Persistence (RDB/AOF) status
dargslan-redis persistence
# Replication information
dargslan-redis replication
# Client connections
dargslan-redis clients
# Issues and alerts
dargslan-redis issues
# Connect to remote server
dargslan-redis report -H redis.example.com -p 6380 -a password
# JSON output
dargslan-redis json
Python API
from dargslan_redis_health import RedisHealth
rh = RedisHealth(host="localhost", port=6379)
# Check if alive
print(f"Redis alive: {rh.is_alive()}")
# Memory metrics
mem = rh.memory_info()
print(f"Memory: {mem[\"used_memory_human\"]} / {mem[\"maxmemory_human\"]}")
print(f"Fragmentation: {mem[\"mem_fragmentation_ratio\"]}")
print(f"Eviction policy: {mem[\"maxmemory_policy\"]}")
# Persistence
pers = rh.persistence_info()
print(f"RDB status: {pers[\"rdb_last_bgsave_status\"]}")
print(f"AOF enabled: {pers[\"aof_enabled\"]}")
# Server info
srv = rh.server_info()
print(f"Version: {srv[\"redis_version\"]}, Uptime: {srv[\"uptime_in_days\"]} days")
# Full audit with alerts
issues = rh.audit()
for i in issues:
print(f"[{i[\"severity\"]}] {i[\"message\"]}")
Alert Thresholds
- Memory > 90% of maxmemory β CRITICAL: Data eviction imminent
- Memory > 75% of maxmemory β WARNING: Plan capacity increase
- maxmemory = 0 β WARNING: Unbounded memory usage
- Fragmentation > 1.5 β WARNING: Memory fragmentation, restart may help
- RDB save failed β CRITICAL: Data not persisted
- Replication link down β CRITICAL: Failover will not work
- Clients > 80% of maxclients β WARNING: Connection pool exhaustion
Download the Redis Health Cheat Sheet
Get our Redis Health Monitoring Cheat Sheet β covering INFO commands, memory thresholds, persistence settings, and eviction policies.
Related Tools
Explore all database monitoring Python tools at dargslan.com. Our Redis and caching eBooks cover performance tuning and high availability.