# Redis Cloud

> Monitor Redis Cloud metrics using OpenTelemetry Collector and Last9

Source: https://last9.io/docs/integrations/databases/redis-cloud/

Use OpenTelemetry to collect Redis Cloud metrics and send them to Last9. This integration works with both Redis Cloud Essentials (free tier) and Pro, using the OTel `redis` receiver which connects over the standard Redis protocol.

## Prerequisites

- Redis Cloud account with a database ([redis.io/try-free](https://redis.io/try-free) for free tier)
- Redis Cloud database endpoint and password (from the database → General → Endpoint section)
- Last9 account with OTLP credentials

## What it collects

| Category    | Metrics (in Last9, dots become underscores)                                                                         |
| ----------- | ------------------------------------------------------------------------------------------------------------------- |
| Memory      | `redis_memory_used`, `redis_memory_peak`, `redis_memory_rss`, `redis_memory_fragmentation_ratio`, `redis_maxmemory` |
| Cache       | `redis_keyspace_hits`, `redis_keyspace_misses`                                                                      |
| Evictions   | `redis_keys_evicted`, `redis_keys_expired`                                                                          |
| Connections | `redis_clients_connected`, `redis_clients_blocked`, `redis_connections_rejected`                                    |
| Throughput  | `redis_commands`, `redis_commands_processed`, `redis_net_input`, `redis_net_output`                                 |
| Replication | `redis_replication_offset`, `redis_slaves_connected`, `redis_role`                                                  |
| Persistence | `redis_rdb_changes_since_last_save`, `redis_uptime`                                                                 |
| Database    | `redis_db_keys`, `redis_db_expires`, `redis_db_avg_ttl`                                                             |
| Host        | CPU, memory, disk, network                                                                                          |

1. **Get your Redis Cloud endpoint**

   From the [Redis Cloud console](https://app.redislabs.com), open your database and copy:

   - **Endpoint** — e.g. `redis-19972.c265.us-east-1-2.ec2.cloud.redislabs.com:19972`
   - **Password** — under Security → Default user password

   Test connectivity:

   ```bash
   redis-cli -h <endpoint-host> -p <endpoint-port> -a <password> PING
   # Expected: PONG
   ```

2. **Install OpenTelemetry Collector**

**DEB Package**

   ```bash
   wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.144.0/otelcol-contrib_0.144.0_linux_amd64.deb
   sudo dpkg -i otelcol-contrib_0.144.0_linux_amd64.deb
   ```

**RPM Package**

   ```bash
   wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.144.0/otelcol-contrib_0.144.0_linux_amd64.rpm
   sudo rpm -ivh otelcol-contrib_0.144.0_linux_amd64.rpm
   ```

**Docker**

   ```bash
   docker run --rm \
     -e REDIS_ENDPOINT=<your-endpoint> \
     -e REDIS_PASSWORD=<your-password> \
     -e OTEL_EXPORTER_OTLP_ENDPOINT="$last9_otlp_endpoint" \
     -e OTEL_EXPORTER_OTLP_HEADERS_AUTHORIZATION="$last9_otlp_auth_header" \
     -v $(pwd)/otel-collector-config.yaml:/etc/otel/config.yaml \
     otel/opentelemetry-collector-contrib:0.144.0 \
     --config /etc/otel/config.yaml
   ```

3. **Configure OpenTelemetry Collector**

   Create or update `/etc/otelcol-contrib/config.yaml`:

   ```yaml
   receivers:
     redis:
       endpoint: "<your-redis-cloud-endpoint>:<port>"
       password: "<your-redis-password>"
       collection_interval: 10s
       # Redis Cloud Essentials: TLS may not be required
       # Redis Cloud Pro: set insecure: false, insecure_skip_verify: true
       tls:
         insecure: true
       metrics:
         redis.maxmemory:
           enabled: true
         redis.role:
           enabled: true

     hostmetrics:
       collection_interval: 60s
       scrapers:
         cpu:
           metrics:
             system.cpu.logical.count:
               enabled: true
         memory:
           metrics:
             system.memory.utilization:
               enabled: true
             system.memory.limit:
               enabled: true
         load:
         disk:
         filesystem:
           metrics:
             system.filesystem.utilization:
               enabled: true
         network:
         paging:

   processors:
     batch:
       timeout: 5s
       send_batch_size: 10000
       send_batch_max_size: 10000
     resourcedetection/system:
       detectors: ["system"]
       system:
         hostname_sources: ["os"]
     resource/redis:
       attributes:
         - key: service.name
           value: redis
           action: insert
         - key: db.system
           value: redis
           action: insert

   exporters:
     otlp_grpc/last9:
       endpoint: "{{ .Logs.WriteURL }}"
       headers:
         "Authorization": "{{ .Logs.AuthValue }}"

   service:
     pipelines:
       metrics:
         receivers: [redis, hostmetrics]
         processors: [batch, resourcedetection/system, resource/redis]
         exporters: [otlp_grpc/last9]
   ```

   :::note
   For **Redis Cloud Pro** with TLS enabled, update the `tls` block:

   ```yaml
   tls:
     insecure: false
     insecure_skip_verify: true
   ```

   :::

4. **Start the Collector**

   ```bash
   sudo systemctl daemon-reload
   sudo systemctl enable otelcol-contrib
   sudo systemctl start otelcol-contrib
   ```

   Check it's running:

   ```bash
   sudo systemctl status otelcol-contrib
   sudo journalctl -u otelcol-contrib -f
   ```

## Verification

Once the collector is running, metrics appear in Last9 within a few seconds.

In the Last9 metrics explorer, search for `redis_` — OTel metric names use dots which are converted to underscores on ingestion (e.g. `redis.memory.used` → `redis_memory_used`).

Key metrics to confirm data is flowing:

```promql
# Memory usage
redis_memory_used

# Cache hit ratio
rate(redis_keyspace_hits[5m]) / (rate(redis_keyspace_hits[5m]) + rate(redis_keyspace_misses[5m]))

# Connected clients
redis_clients_connected

# Eviction rate
rate(redis_keys_evicted[5m])
```

---

## Troubleshooting

**Cannot connect to Redis Cloud endpoint**

Test connectivity directly:

```bash
redis-cli -h <host> -p <port> -a <password> PING
```

If this fails, verify the endpoint is publicly accessible. Redis Cloud Essentials databases are public by default; Pro databases may require VPC peering.

**No metrics appearing in Last9**

Check collector logs for errors:

```bash
sudo journalctl -u otelcol-contrib --no-pager | grep -i error
```

Validate your config:

```bash
otelcol-contrib --config /etc/otelcol-contrib/config.yaml validate
```

## Need Help?

- Join our [Discord community](https://discord.com/channels/652153247672729619/652153247672729621) for real-time support
- Contact our support team at [support@last9.io](mailto:support@last9.io)
