Integrate a Redis/Valkey instance

Updated at:

This topic describes how to integrate a Redis/Valkey instance with Cloud Monitor 2.0. The integration component is based on the Redis adapter of aio-exporter and collects metrics such as performance, memory, client connections, keyspace hits and evictions, persistence, and master-slave replication. It supports Redis 5.x and later (version 6.2 or later is required for full functionality), is compatible with Valkey 7.x, 8.x, and 9.x, and can be deployed in Container Service for Kubernetes (ACK) clusters and on Elastic Compute Service (ECS) instances in a virtual private cloud (VPC) environment. After integration, Redis instance entities and a built-in dashboard are automatically generated.

Requirements

Before you start the integration, make sure that the target instance meets the following requirements. Otherwise, no data may be collected or some metrics may be missing.

Condition

Requirement

Version

Redis 5.x or later. Full functionality requires Redis 6.2 or later, and latency histograms require Redis 7.0 or later. An ACL username requires Redis 6.0 or later. Valkey 7.x, 8.x, and 9.x are compatible.

Deployment type

Self-managed Redis or Valkey. A cloud-managed instance can also be integrated if it meets the account and network conditions.

Authentication

(Recommended) For Redis 6.0 and later, create a dedicated ACL monitoring user. If only requirepass is configured, enter the password and leave the username blank. Enter the username and the password in separate fields. Do not include them in the address.

Network connectivity

In the CS environment, the target Redis instance must be reachable within the network of the selected ACK cluster. In the ECS (VPC) environment, the vSwitch CIDR block of the fully managed collector must be able to access the target ECS instance.

Prerequisites

  • Managed Service for Prometheus is activated.

  • CS environment — The target ACK cluster is integrated with Cloud Monitor 2.0 and is in the Running state. The target Redis service is accessible from the cluster network.

  • ECS (VPC) environment — The target Redis service is deployed on an ECS instance.

Billing

  • Billing is based solely on the volume of metric data generated in Billing overview.

Integration methods

Step 1: Prepare a monitoring account (if needed)

For Redis 6.0 or later, we recommend that you create a separate Access Control List (ACL) user for monitoring. If you use only requirepass for password authentication, you can provide a password and leave the username empty.

ACL SETUSER exporter on ><password> -@all +@connection +memory -readonly +strlen +config|get +xinfo +pfcount -quit +zcard +type +xlen -readwrite -command +client -wait +scard +llen +hlen +arcount +get +eval +slowlog +cluster|info +cluster|slots +cluster|nodes -hello -echo +info +latency +scan -reset -auth -asking

The ACL user must have read-only permissions for commands such as INFO, CONFIG GET, CLIENT, SLOWLOG, LATENCY, and MEMORY. In Sentinel scenarios, permissions for commands such as +sentinel|masters are also required.

Step 2: Select an integration environment

This plugin supports two access environments: CS and ECS (VPC). Select the appropriate environment based on where your Redis instance is deployed:

CS

  • The Exporter is installed in the specified ACK cluster and reuses the existing data collector in the cluster to collect metrics.

  • The monitored object is the ACK cluster.

  • Network requirements: The target Redis service must be reachable from the cluster network. For example, it can be a Service within the cluster or an internal VPC address that the cluster can access.

ECS (VPC)

  • A fully managed data collector is deployed based on the VPC information of the ECS instance where the Redis service is deployed.

  • No processes are installed on the ECS instance.

  • The monitored object is the ECS instance.

  • Network requirements: The vSwitch CIDR block for the managed data collector must have access to the target ECS instance. You must configure security groups, ACLs, and other rules to allow access.

Environment

Exporter deployment location

Process installed on workload host?

Monitored object

Network connectivity requirements

CS

A specified ACK cluster

No. The Exporter is deployed in the cluster and does not run on the application's host node.

ACK cluster

Redis must be reachable from the cluster network.

ECS (VPC)

Fully managed data collector deployed by the system based on the VPC

No. No processes are installed on the ECS instance.

ECS instance

The vSwitch CIDR block of the managed agent must have access to the target ECS instance.

Step 3: Configure the integration

  1. Log on to the Cloud Monitor console, and select a workspace. In the navigation pane on the left, click Integration Center. Then, click Redis to start the integration.

  2. Select CS or ECS (VPC) as the access environment, and then select an Observation object from the drop-down list.

  3. Complete the following configuration and click OK:

    Configuration Item

    Required

    Description

    Redis Endpoint

    Yes

    For a CS environment, enter the in-cluster endpoint. For an ECS (VPC) environment, enter the internal or public endpoint. Do not include the username or password in the endpoint.

    Redis Service Port

    Yes

    Default: 6379

    Cloud Vendor/Deployment Source

    No

    This value is written to the provider tag. For self-hosted deployments, enter self-hosted/redis.

    Network Connectivity Test

    —

    Available only for CS environments.

    Redis Username

    No

    The username for a Redis 6.0+ ACL user. If you leave this empty, the system uses the `default` user (password only).

    Redis Logon Password

    No

    The password for the monitoring account.

    Metric Collection Interval (seconds)

    Yes

    Default: 15

    Custom Tags

    No

    Additional tags to add to metrics.

    Use Public Registry Address

    No

    Disabled by default. Enable this option if the internal image repository is inaccessible.

  4. After the integration is complete, you can view the integrated entities and their observable data in Entity Explorer.

Data usage

Entities

After you integrate Redis, Cloud Monitor periodically discovers Redis instances from the labels of metrics such as redis_up and creates middleware entities.

Dimension

Description

Domain

middleware

Entity type

middleware.redis

Entity filter condition

.entity with(domain='middleware', type='middleware.redis')

Observed object (bound entity)

For CS environments, the object is acs.ack.cluster. For ECS (VPC) environments, the object is acs.ecs.instance.

Entity fields are derived from collected labels and are not related to the number of installations.

Field

Description

instance_id

Instance identity. This field is derived from the target_uri label in the host:port format.

provider

Deployment source, such as self-hosted/redis.

port

Service port.

region_id

Region.

env_type

Deployment environment type (CS or ECS).

cluster_id

ID of the cluster to which the instance belongs.

You can retrieve instances using these fields in the Entity Explorer or Middleware Insight application.

Built-in dashboards

Dashboard name

Access point

Description

Instance Overview

The Instance Overview tab on the entity details page.

UModel dashboard. Variables are automatically bound based on the instance context.

Redis Overview

Grafana dashboard list.

Grafana dashboard. Available in both Chinese and English.

Core metrics

The following is a complete list of the 64 metrics for the middleware.metric.redis entity dataset. You can use these metrics directly on the entity details page, in dashboards, and in alerts.

Metric name

Type

Unit

Display name

Description

redis_up

gauge

-

Redis availability

Indicates whether the Redis/Valkey instance is reachable and data collection is successful. A value of 1 indicates that the instance is available. A value of 0 indicates that the instance is unavailable.

redis_uptime

gauge

Seconds

Uptime

The number of seconds that the Redis service process has been running since it started.

redis_clients

gauge

-

Client connections

The number of client connections to Redis. This does not include connections from replicas.

redis_blocked

gauge

-

Blocked clients

The number of clients waiting due to blocking commands, such as BLPOP, BRPOP, and BZPOP.

redis_slaves

gauge

-

Number of secondary nodes

The number of connected replicas (secondary nodes).

redis_commands_s

counter

Commands/s

Commands per second

The total number of commands processed per second.

redis_hit_rate

counter

%

Cache hit rate

The keyspace hit rate, calculated as hits / (hits + misses) and expressed as a percentage.

redis_evicted_s

counter

Keys/s

Evicted keys per second

The rate at which keys are evicted because the maxmemory limit is reached.

redis_memory_usage

gauge

%

Memory usage

The percentage of used memory relative to the maxmemory limit.

redis_used

gauge

Bytes

Used memory

The total number of bytes allocated by Redis for data (used_memory).

redis_max

gauge

Bytes

Maximum memory

The configured maxmemory limit in bytes. A value of 0 indicates no limit.

redis_rss

gauge

Bytes

RSS memory

Resident Set Size (RSS) memory. The number of bytes of resident memory that the Redis process occupies from the operating system's perspective.

redis_peak

gauge

Bytes

Peak memory

The peak value of used_memory since the instance started.

redis_dataset

gauge

Bytes

Dataset memory

The number of bytes occupied by the dataset. This does not include metadata overhead.

redis_overhead

gauge

Bytes

Memory overhead

The number of bytes occupied by overhead, such as Redis metadata and internal structures.

redis_fragmentation

gauge

-

Memory fragmentation ratio

The ratio of RSS to used_memory. A value significantly higher than 1.5 may indicate memory fragmentation.

redis_allocator_frag

gauge

-

Allocator fragmentation ratio

The memory allocator fragmentation ratio reported by Redis.

redis_tracking

gauge

-

Monitoring the client count

The number of clients that have client-side caching tracking enabled.

redis_received_s

counter

Times per second

New connections per second

The rate at which new client connections are accepted.

redis_rejected_s

counter

Count per second

Rejected connections per second

The rate at which connections are rejected because the maxclients limit is reached.

redis_input

counter

Bytes

Inbound traffic

The number of bytes received from the network per second.

redis_output

counter

Bytes

Outbound traffic

The number of bytes sent to the network per second.

redis_max_input

gauge

Bytes

Maximum input buffer

The maximum number of bytes in the client input buffer recently.

redis_max_output

gauge

Bytes

Maximum output buffer

The maximum number of bytes in the client output buffer recently.

redis_top_command_calls_sec

counter

-

Top command calls

The call rate of the top 10 commands, aggregated by command type.

redis_command_duration_sec_by_cmd

counter

-

Top command duration

The execution duration rate (in seconds) of the top 10 commands, aggregated by command type.

redis_failed

counter

-

Failed commands

The call rate of failed commands, aggregated by command type.

redis_rejected

counter

-

Rejected commands

The call rate of rejected commands, such as out-of-memory (OOM) errors, aggregated by command type.

redis_sys

counter

-

System CPU

The system mode CPU time consumed per second by the main Redis process.

redis_user

counter

-

User CPU

The user mode CPU time consumed per second by the main Redis process.

redis_sys_children

counter

-

Child process system CPU

The system mode CPU time consumed per second by background child processes, such as bgsave.

redis_user_children

counter

-

Child process user CPU

The user mode CPU time consumed per second by background child processes.

redis_keys_per_db

gauge

-

Keys per DB

The number of keys in each logical database.

redis_non_expiring

gauge

-

Non-expiring keys

The number of keys that do not have a time-to-live (TTL) set.

redis_expiring

gauge

-

Expiring keys

The number of keys that have a TTL set.

redis_hits

counter

-

Keyspace hits

The rate of successful key lookups (hits).

redis_misses

counter

-

Keyspace misses

The rate of failed key lookups (misses).

redis_expired

counter

-

Expired keys

The rate at which keys are deleted due to expiration.

redis_avg_ttl_per_db

gauge

Seconds

Average TTL per DB

The average TTL (in seconds) of keys with an expiration time in each database.

redis_rdb_bgsave_ok

gauge

-

RDB background save status

Indicates whether the last background RDB save was successful. 1 indicates success, and 0 indicates failure.

redis_rdb_bgsave_in_progress

gauge

-

RDB background save in progress

Indicates whether a background RDB save is in progress. 1 indicates yes, and 0 indicates no.

redis_aof_enabled

gauge

-

AOF enabled

Indicates whether Append-Only File (AOF) persistence is enabled. 1 indicates yes, and 0 indicates no.

redis_aof_bgrewrite_ok

gauge

-

AOF rewrite status

Indicates whether the last background AOF rewrite was successful. 1 indicates success, and 0 indicates failure.

redis_aof_write_ok

gauge

-

AOF write status

Indicates whether the last AOF write was successful. 1 indicates success, and 0 indicates failure.

redis_loading

gauge

-

Loading data

Indicates whether data is being loaded from a dump file. 1 indicates yes, and 0 indicates no.

redis_lag

gauge

Seconds

Replica lag

The replication delay (in seconds) of a connected replica relative to the primary node.

redis_master_offset

gauge

-

Primary replication offset

The current replication offset of the primary node.

redis_slave_offset

gauge

-

Secondary replication offset

The current replication offset of this replica.

redis_master_link_up

gauge

-

Primary-secondary link status

Indicates whether the link between the replica and the primary node is active. 1 indicates active, and 0 indicates disconnected.

redis_master_last_io_ago

gauge

Seconds

Time since last primary IO

The number of seconds since the last interaction with the primary node, from the replica's perspective.

redis_changes_since_last_save

gauge

-

Changes since last save

The number of changes since the last successful RDB save.

redis_last_bgsave_duration

gauge

-

Last BGSAVE duration

The duration (in seconds) of the last background RDB save.

redis_aof_size

gauge

Bytes

Current AOF size

The current size of the AOF file in bytes.

redis_channels

gauge

-

Pub/Sub channels

The number of active Publish/Subscribe (Pub/Sub) channels.

redis_patterns

gauge

-

Pub/Sub Pattern Count

The number of active Pub/Sub pattern subscriptions.

redis_pubsub_clients

gauge

-

Pub/Sub clients

The number of clients in Pub/Sub mode.

redis_length

gauge

-

Slow log entries

The number of entries in the current slow query log.

redis_last_slow_duration

gauge

Seconds

Last slow command duration

The execution duration (in seconds) of the most recent command in the slow query log.

redis_latency_spikes

gauge

Seconds

Latency spike duration

The duration of recent latency spikes reported by Redis latency monitoring.

redis_cycles_s

gauge

Cycles/s

Event loop cycles per second

The instantaneous number of event loop cycles per second.

redis_duration_usec

gauge

-

Event loop duration

The instantaneous duration of the event loop in microseconds.

redis_error_replies_s

counter

Replies/s

Error replies per second

The rate of error replies sent to clients.

redis_error_replies

counter

-

Error replies by type

The rate of error replies, aggregated by error type.

redis_last_scrape_error

gauge

-

Last scrape error

Indicates whether the last redis_exporter scrape failed. 1 indicates failure, and 0 indicates success.

In addition to the preceding MetricSet aggregation metrics, all raw metrics (prefixed with redis_*) collected by the exporter are written to Prometheus storage. You can query these metrics directly using Prometheus Query Language (PromQL).

Common query examples

# Availability
redis_up

# Memory usage
redis_memory_used_bytes / clamp_min(redis_memory_max_bytes, 1) * 100

# Hit rate
rate(redis_keyspace_hits_total[5m])
  / clamp_min(rate(redis_keyspace_hits_total[5m]) + rate(redis_keyspace_misses_total[5m]), 1)

Alert templates

This integration component does not have built-in alert rules. You can configure alerts in the Alert Center based on the metrics described previously. For example, you can set alerts for scenarios where the redis_up availability metric is not 1, or when the number of connections or message accumulation exceeds a threshold.

Storage policies

After you integrate Redis, Cloud Monitor creates a corresponding storage instance to store observable data.

Data type

Default storage location

Notes

Metrics

Prometheus instance: RegionShare:{{workspaceName}}:{{regionId}}

Associated with the middleware.metric.redis dataset.

Manage or remove the integration

To modify or cancel the integration, go to the Integration Management page of Integration Center, find the corresponding integration policy, and then click Edit or Delete. When you delete the integration policy, the Exporter and the collection configuration are removed together. Historical metrics that have already been written are retained based on the lifecycle policy of the storage.