Parseable

Redis

Monitor Redis metrics with Parseable using OpenTelemetry


Monitor your Redis instances by collecting metrics using the OpenTelemetry Collector and sending them to Parseable.

Overview

The OpenTelemetry Collector's Redis receiver collects metrics from Redis instances using the INFO command including:

  • Server Statistics - Uptime, connected clients, memory usage
  • Memory Metrics - Used memory, peak memory, fragmentation
  • Persistence Metrics - RDB and AOF status
  • Replication Metrics - Master/replica status and lag
  • Command Statistics - Commands processed, keyspace hits/misses

Prerequisites

  • Redis 4.0+
  • OpenTelemetry Collector with redis receiver
  • Parseable instance running and accessible

Redis Authentication (Optional)

If your Redis instance requires authentication:

# Redis 6.0+ with ACL
redis-cli ACL SETUSER otel on >your-password +info +client +slowlog +latency allkeys

# Redis < 6.0 with requirepass
# Set password in redis.conf: requirepass your-password

OpenTelemetry Collector Configuration

Basic Configuration

Create an otel-collector-config.yaml file:

receivers:
  redis:
    endpoint: "localhost:6379"
    collection_interval: 10s
    password: ${env:REDIS_PASSWORD}

exporters:
  otlphttp/parseable:
    endpoint: "http://parseable:8000"
    headers:
      Authorization: "Basic YWRtaW46YWRtaW4="
      X-P-Stream: "redis-metrics"
      X-P-Log-Source: "otel-metrics"
    tls:
      insecure: true

service:
  pipelines:
    metrics:
      receivers: [redis]
      exporters: [otlphttp/parseable]

TLS Configuration

For Redis instances with TLS enabled:

receivers:
  redis:
    endpoint: "localhost:6379"
    collection_interval: 10s
    username: otel
    password: ${env:REDIS_PASSWORD}
    tls:
      insecure: false
      ca_file: /path/to/ca.crt
      cert_file: /path/to/client.crt
      key_file: /path/to/client.key

exporters:
  otlphttp/parseable:
    endpoint: "http://parseable:8000"
    headers:
      Authorization: "Basic YWRtaW46YWRtaW4="
      X-P-Stream: "redis-metrics"
      X-P-Log-Source: "otel-metrics"
    tls:
      insecure: true

service:
  pipelines:
    metrics:
      receivers: [redis]
      exporters: [otlphttp/parseable]

Unix Socket Configuration

For Redis instances using Unix sockets:

receivers:
  redis:
    endpoint: "/var/run/redis/redis.sock"
    transport: unix
    collection_interval: 10s
    password: ${env:REDIS_PASSWORD}

exporters:
  otlphttp/parseable:
    endpoint: "http://parseable:8000"
    headers:
      Authorization: "Basic YWRtaW46YWRtaW4="
      X-P-Stream: "redis-metrics"
      X-P-Log-Source: "otel-metrics"
    tls:
      insecure: true

service:
  pipelines:
    metrics:
      receivers: [redis]
      exporters: [otlphttp/parseable]

Configuration Options

ParameterDefaultDescription
endpoint-Redis server endpoint (required)
transporttcpTransport protocol (tcp or unix)
username-Username for Redis 6.0+ ACL
password-Redis password
collection_interval10sMetrics collection interval
tls.insecuretrueDisable TLS
tls.ca_file-CA certificate path
tls.cert_file-Client certificate path
tls.key_file-Client key path

Collected Metrics

The Redis receiver collects the following metrics:

MetricDescription
redis.clients.connectedNumber of connected clients
redis.clients.blockedNumber of blocked clients
redis.clients.max_input_bufferBiggest input buffer
redis.clients.max_output_bufferBiggest output buffer
redis.commandsTotal commands processed
redis.commands.processedCommands processed per second
redis.connections.receivedTotal connections received
redis.connections.rejectedRejected connections
redis.cpu.timeCPU time consumed
redis.db.avg_ttlAverage TTL of keys
redis.db.expiresKeys with expiration
redis.db.keysTotal keys in database
redis.keys.evictedEvicted keys
redis.keys.expiredExpired keys
redis.keyspace.hitsKeyspace hits
redis.keyspace.missesKeyspace misses
redis.memory.fragmentation_ratioMemory fragmentation ratio
redis.memory.luaLua memory usage
redis.memory.peakPeak memory usage
redis.memory.rssResident set size
redis.memory.usedUsed memory
redis.net.inputNetwork input bytes
redis.net.outputNetwork output bytes
redis.rdb.changes_since_last_saveChanges since last RDB save
redis.replication.backlog_first_byte_offsetReplication backlog offset
redis.replication.offsetReplication offset
redis.slaves.connectedConnected replicas
redis.uptimeServer uptime in seconds

Running the Collector

Docker

docker run -d \
  --name otel-collector \
  -v $(pwd)/otel-collector-config.yaml:/etc/otelcol/config.yaml \
  -e REDIS_PASSWORD=your-password \
  otel/opentelemetry-collector-contrib:latest

Docker Compose

version: '3.8'
services:
  otel-collector:
    image: otel/opentelemetry-collector-contrib:latest
    volumes:
      - ./otel-collector-config.yaml:/etc/otelcol/config.yaml
    environment:
      - REDIS_PASSWORD=${REDIS_PASSWORD}
    depends_on:
      - redis
      - parseable

Querying Redis Metrics in Parseable

Once data is flowing, query your Redis metrics:

-- Get memory usage over time
SELECT p_timestamp, memory_used, memory_peak 
FROM "redis-metrics" 
ORDER BY p_timestamp DESC 
LIMIT 100

-- Calculate cache hit ratio
SELECT 
  p_timestamp,
  keyspace_hits,
  keyspace_misses,
  (keyspace_hits::float / NULLIF(keyspace_hits + keyspace_misses, 0)) * 100 as hit_ratio
FROM "redis-metrics"
WHERE p_timestamp > NOW() - INTERVAL '1 hour'
ORDER BY p_timestamp DESC

Troubleshooting

Connection Issues

If the collector can't connect to Redis:

  1. Verify Redis is accepting connections on the configured port
  2. Check the password is correct
  3. Verify protected-mode settings in Redis
  4. Check firewall rules allow the connection

Missing Metrics

If some metrics are not appearing:

  1. Ensure the Redis user has permission to run INFO command
  2. Check if specific features (like replication) are enabled
  3. Verify the Redis version supports the metrics

Next Steps

Was this page helpful?

On this page