Skip to main content

Redis

The OpenTelemetry Collector's Redis receiver collects 31+ metrics from Redis 6.0+, including memory usage, keyspace hit ratios, connection counts, command latency, and replication status. This guide configures the receiver, verifies connectivity, and ships metrics to base14 Scout.

Prerequisites​

RequirementMinimumRecommended
Redis6.07.0+
OTel Collector Contrib0.90.0latest
base14 ScoutAny-

Before starting:

  • Redis must be accessible from the host running the Collector
  • Redis password (if authentication is enabled)
  • OTel Collector installed - see Docker Compose Setup

What You'll Monitor​

  • Memory: used memory, peak memory, RSS, Lua memory, fragmentation ratio
  • Connections: connected clients, blocked clients, received/rejected connections
  • Keyspace: hits, misses, expired keys, evicted keys
  • Throughput: commands processed, network I/O, command latency
  • Persistence: RDB changes since last save, latest fork duration
  • Replication: connected replicas, replication offset, backlog offset

Full metric reference: OTel Redis Receiver

Access Setup​

Redis uses password-based authentication (if enabled). No special user creation is required - the Collector connects using the standard AUTH command.

Verify connectivity:

# With authentication
redis-cli -h <redis-host> -p <redis-port> -a <password> ping

# Without authentication
redis-cli -h <redis-host> -p <redis-port> ping

Configuration​

config/otel-collector.yaml
receivers:
redis:
endpoint: ${env:REDIS_ENDPOINT}
collection_interval: 20s
# password: ${env:REDIS_PASSWORD} # Uncomment if authentication is enabled

metrics:
redis.maxmemory:
enabled: true
redis.role:
enabled: true
redis.cmd.calls:
enabled: true
redis.cmd.usec:
enabled: true
redis.cmd.latency:
enabled: true
redis.uptime:
enabled: true
redis.cpu.time:
enabled: true
redis.clients.connected:
enabled: true
redis.clients.max_input_buffer:
enabled: true
redis.clients.max_output_buffer:
enabled: true
redis.clients.blocked:
enabled: true
redis.keys.expired:
enabled: true
redis.keys.evicted:
enabled: true
redis.connections.received:
enabled: true
redis.connections.rejected:
enabled: true
redis.memory.used:
enabled: true
redis.memory.peak:
enabled: true
redis.memory.rss:
enabled: true
redis.memory.lua:
enabled: true
redis.memory.fragmentation_ratio:
enabled: true
redis.rdb.changes_since_last_save:
enabled: true
redis.commands:
enabled: true
redis.commands.processed:
enabled: true
redis.net.input:
enabled: true
redis.net.output:
enabled: true
redis.keyspace.hits:
enabled: true
redis.keyspace.misses:
enabled: true
redis.latest_fork:
enabled: true
redis.slaves.connected:
enabled: true
redis.replication.backlog_first_byte_offset:
enabled: true
redis.replication.offset:
enabled: true
redis.db.keys:
enabled: true
redis.db.expires:
enabled: true
redis.db.avg_ttl:
enabled: true
redis.replication.replica_offset:
enabled: true

processors:
resource:
attributes:
- key: environment
value: ${env:ENVIRONMENT}
action: upsert
- key: service.name
value: ${env:SERVICE_NAME}
action: upsert

batch:
timeout: 10s
send_batch_size: 1024

# Export to base14 Scout
exporters:
otlphttp/b14:
endpoint: ${env:OTEL_EXPORTER_OTLP_ENDPOINT}
tls:
insecure_skip_verify: true

service:
pipelines:
metrics:
receivers: [redis]
processors: [batch, resource]
exporters: [otlphttp/b14]

Environment Variables​

.env
REDIS_ENDPOINT=localhost:6379
REDIS_PASSWORD=your_password
ENVIRONMENT=your_environment
SERVICE_NAME=your_service_name
OTEL_EXPORTER_OTLP_ENDPOINT=https://<your-tenant>.base14.io

Verify the Setup​

Start the Collector and check for metrics within 60 seconds:

# Check Collector logs for successful connection
docker logs otel-collector 2>&1 | grep -i "redis"

# Verify Redis is responding
redis-cli -h ${REDIS_HOST} -p ${REDIS_PORT} info

Troubleshooting​

Connection refused​

Cause: Collector cannot reach Redis at the configured endpoint.

Fix:

  1. Verify Redis is running: systemctl status redis or docker ps | grep redis
  2. Confirm the endpoint address and port (default 6379) in your config
  3. Check bind directive in redis.conf - change to 0.0.0.0 if the Collector runs on a separate host

Authentication failed (NOAUTH)​

Cause: Redis requires a password but none is configured in the receiver.

Fix:

  1. Uncomment the password field in the receiver config
  2. Set REDIS_PASSWORD in your environment variables
  3. Test credentials: redis-cli -a $REDIS_PASSWORD ping

No metrics appearing in Scout​

Cause: Metrics are collected but not exported.

Fix:

  1. Check Collector logs for export errors: docker logs otel-collector
  2. Verify OTEL_EXPORTER_OTLP_ENDPOINT is set correctly
  3. Confirm the pipeline includes both the receiver and exporter

Memory fragmentation ratio above 1.5​

Cause: This is not a collection issue - fragmentation ratio above 1.5 indicates Redis memory fragmentation.

Fix:

  1. The redis.memory.fragmentation_ratio metric is reporting correctly
  2. Values above 1.5 suggest memory management issues - consider restarting Redis or tuning activedefrag settings
  3. Monitor alongside redis.memory.used and redis.memory.rss

FAQ​

Does this work with Redis running in Kubernetes?

Yes. Set endpoint to the Redis service DNS (e.g., redis.default.svc.cluster.local:6379) and inject the password via a Kubernetes secret. The Collector can run as a sidecar or DaemonSet.

How do I monitor multiple Redis instances?

Add multiple receiver blocks with distinct names:

receivers:
redis/primary:
endpoint: redis-1:6379
redis/replica:
endpoint: redis-2:6379

Then include both in the pipeline: receivers: [redis/primary, redis/replica]

What about Redis Cluster mode?

Each Redis Cluster node must be monitored individually. Add a separate receiver block for each node endpoint. The Collector connects to each node's standard Redis port, not the cluster bus port.

Why are replication metrics showing zero?

redis.slaves.connected, redis.replication.offset, and redis.replication.replica_offset require replication to be configured. On standalone instances without replicas, these metrics report zero — this is expected.

What's Next?​

  • Create Dashboards: Explore pre-built dashboards or build your own. See Create Your First Dashboard
  • Monitor More Components: Add monitoring for Memcached, RabbitMQ, and other components
  • Fine-tune Collection: Adjust collection_interval based on your cache usage patterns
  • Visualize in Scout: Once metrics are flowing, you can track Redis performance metrics in Scout
    • build dashboards for hit ratios, memory usage, and connection patterns
Was this page helpful?