Whether you use Redis as a database, cache, or message queue, this integration helps you track problems with your Redis servers and the parts of your infrastructure that they serve. The Datadog Agent’s Redis check collects metrics related to performance, memory usage, blocked clients, slave connections, disk persistence, expired and evicted keys, and many more.
The Redis check is included in the Datadog Agent package, so you don’t need to install anything else on your Redis servers.
To configure this check for an Agent running on a host:
Edit the redisdb.d/conf.yaml
file, in the conf.d/
folder at the root of your Agent’s configuration directory. The following parameters may require updating. See the sample redisdb.d/conf.yaml for all available configuration options.
init_config:
instances:
## @param host - string - required
## Enter the host to connect to.
- host: localhost
## @param port - integer - required
## Enter the port of the host to connect to.
port: 6379
## @param username - string - optional
## The username to use for the connection. Redis 6+ only.
#
# username: <USERNAME>
## @param password - string - optional
## The password to use for the connection.
#
# password: <PASSWORD>
If using Redis 6+ and ACLs, ensure that the user has at least DB Viewer
permissions at the Database level, and Cluster Viewer
permissions if operating in a cluster environment. For more details, see the documentation.
Available for Agent versions >6.0
Collecting logs is disabled by default in the Datadog Agent, enable it in your datadog.yaml
file:
logs_enabled: true
Uncomment and edit this configuration block at the bottom of your redisdb.d/conf.yaml
:
logs:
- type: file
path: /var/log/redis_6379.log
source: redis
service: myapplication
Change the path
and service
parameter values and configure them for your environment. See the sample redisdb.yaml for all available configuration options.
Datadog APM integrates with Redis to see the traces across your distributed system. Trace collection is enabled by default in the Datadog Agent v6+. To start collecting traces:
To configure this check for an Agent running on a container:
Set Autodiscovery Integrations Templates as Docker labels on your application container:
LABEL "com.datadoghq.ad.check_names"='["redisdb"]'
LABEL "com.datadoghq.ad.init_configs"='[{}]'
LABEL "com.datadoghq.ad.instances"='[{"host":"%%host%%","port":"6379","password":"%%env_REDIS_PASSWORD%%"}]'
Note: The "%%env_<ENV_VAR>%%"
template variable logic is used to avoid storing the password in plain text, hence the REDIS_PASSWORD
environment variable must be set on the Agent container. See the Autodiscovery Template Variable documentation for more details. Alternatively, the Agent can leverage the secrets
package to work with any secrets management backend (such as HashiCorp Vault or AWS Secrets Manager).
Available for Agent versions >6.0
Collecting logs is disabled by default in the Datadog Agent. To enable it, see the Docker log collection documentation.
Then, set Log Integrations as Docker labels:
LABEL "com.datadoghq.ad.logs"='[{"source":"redis","service":"<YOUR_APP_NAME>"}]'
APM for containerized apps is supported on Agent v6+ but requires extra configuration to begin collecting traces.
Required environment variables on the Agent container:
Parameter | Value |
---|---|
<DD_API_KEY> | api_key |
<DD_APM_ENABLED> | true |
<DD_APM_NON_LOCAL_TRAFFIC> | true |
See Tracing Docker Applications for a complete list of available environment variables and configuration.
Then, instrument your application container that makes requests to Redis and set DD_AGENT_HOST
to the name of your Agent container.
To configure this check for an Agent running on Kubernetes:
Set Autodiscovery Integrations Templates as pod annotations on your application container. Aside from this, templates can also be configure via a file, a configmap, or a key-value store.
apiVersion: v1
kind: Pod
metadata:
name: redis
annotations:
ad.datadoghq.com/redis.check_names: '["redisdb"]'
ad.datadoghq.com/redis.init_configs: '[{}]'
ad.datadoghq.com/redis.instances: |
[
{
"host": "%%host%%",
"port":"6379",
"password":"%%env_REDIS_PASSWORD%%"
}
]
labels:
name: redis
spec:
containers:
- name: redis
image: redis:latest
ports:
- containerPort: 6379
Note: The "%%env_<ENV_VAR>%%"
template variable logic is used to avoid storing the password in plain text, hence the REDIS_PASSWORD
environment variable must be set on the Agent container. See the Autodiscovery Template Variable documentation. Alternatively, the Agent can leverage the secrets
package to work with any secrets management backend (such as HashiCorp Vault or AWS Secrets Manager).
Available for Agent versions >6.0
Collecting logs is disabled by default in the Datadog Agent. To enable it, see the Kubernetes log collection documentation.
Then, set Log Integrations as pod annotations. This can also be configure via a file, a configmap, or a key-value store.
apiVersion: v1
kind: Pod
metadata:
name: redis
annotations:
ad.datadoghq.com/redis.logs: '[{"source":"redis","service":"<YOUR_APP_NAME>"}]'
labels:
name: redis
spec:
containers:
- name: redis
image: redis:latest
ports:
- containerPort: 6379
APM for containerized apps is supported on hosts running Agent v6+ but requires extra configuration to begin collecting traces.
Required environment variables on the Agent container:
Parameter | Value |
---|---|
<DD_API_KEY> | api_key |
<DD_APM_ENABLED> | true |
<DD_APM_NON_LOCAL_TRAFFIC> | true |
See Tracing Kubernetes Applications and the Kubernetes Daemon Setup for a complete list of available environment variables and configuration.
Then, instrument your application container that makes requests to Redis.
To configure this check for an Agent running on ECS:
Set Autodiscovery Integrations Templates as Docker labels on your application container:
{
"containerDefinitions": [{
"name": "redis",
"image": "redis:latest",
"dockerLabels": {
"com.datadoghq.ad.check_names": "[\"redisdb\"]",
"com.datadoghq.ad.init_configs": "[{}]",
"com.datadoghq.ad.instances": "[{\"host\":\"%%host%%\",\"port\":\"6379\",\"password\":\"%%env_REDIS_PASSWORD%%\"}]"
}
}]
}
Note: The "%%env_<ENV_VAR>%%"
template variable logic is used to avoid storing the password in plain text, hence the REDIS_PASSWORD
environment variable must be set on the Agent container. See the Autodiscovery Template Variable documentation. Alternatively, the Agent can leverage the secrets
package to work with any secrets management backend (such as HashiCorp Vault or AWS Secrets Manager).
Available for Agent versions >6.0
Collecting logs is disabled by default in the Datadog Agent. To enable it, see the ECS log collection documentation.
Then, set Log Integrations as Docker labels:
{
"containerDefinitions": [{
"name": "redis",
"image": "redis:latest",
"dockerLabels": {
"com.datadoghq.ad.logs": "[{\"source\":\"redis\",\"service\":\"<YOUR_APP_NAME>\"}]"
}
}]
}
APM for containerized apps is supported on Agent v6+ but requires extra configuration to begin collecting traces.
Required environment variables on the Agent container:
Parameter | Value |
---|---|
<DD_API_KEY> | api_key |
<DD_APM_ENABLED> | true |
<DD_APM_NON_LOCAL_TRAFFIC> | true |
See Tracing Docker Applications for a complete list of available environment variables and configuration.
Then, instrument your application container that makes requests to Redis and set DD_AGENT_HOST
to the EC2 private IP address.
Run the Agent’s status subcommand and look for redisdb
under the Checks section.
redis.active_defrag.running (gauge) | Whether active defragmentation is running or not. |
redis.active_defrag.hits (gauge) | Number of value reallocations performed by the active defragmentation process. Shown as operation |
redis.active_defrag.misses (gauge) | Number of aborted value reallocations started by the active defragmentation process. Shown as operation |
redis.active_defrag.key_hits (gauge) | Number of keys that were actively defragmented. Shown as key |
redis.active_defrag.key_misses (gauge) | Number of keys that were skipped by. Shown as key |
redis.aof.buffer_length (gauge) | Size of the AOF buffer. Shown as byte |
redis.aof.last_rewrite_time (gauge) | Duration of the last AOF rewrite. Shown as second |
redis.aof.rewrite (gauge) | Flag indicating a AOF rewrite operation is on-going. |
redis.aof.size (gauge) | AOF current file size (aof_current_size). Shown as byte |
redis.aof.loading_total_bytes (gauge) | The total amount of bytes already loaded. Shown as byte |
redis.aof.loading_loaded_bytes (gauge) | The amount of bytes to load. Shown as byte |
redis.aof.loading_loaded_perc (gauge) | The percent loaded. Shown as percent |
redis.aof.loading_eta_seconds (gauge) | The estimated amount of time left to load. Shown as second |
redis.clients.biggest_input_buf (gauge) | The biggest input buffer among current client connections. |
redis.clients.blocked (gauge) | The number of connections waiting on a blocking call. Shown as connection |
redis.clients.longest_output_list (gauge) | The longest output list among current client connections. |
redis.cpu.sys (gauge) | System CPU consumed by the Redis server. |
redis.cpu.sys_children (gauge) | System CPU consumed by the background processes. |
redis.cpu.user (gauge) | User CPU consumed by the Redis server. |
redis.cpu.user_children (gauge) | User CPU consumed by the background processes. |
redis.expires (gauge) | The number of keys with an expiration. Shown as key |
redis.expires.percent (gauge) | Percentage of total keys with an expiration. Shown as percent |
redis.info.latency_ms (gauge) | The latency of the redis INFO command. Shown as millisecond |
redis.key.length (gauge) | The number of elements in a given key, tagged by key, e.g. 'key:mykeyname'. Enable in Agent's redisdb.yaml with the keys option. |
redis.keys (gauge) | The total number of keys. Shown as key |
redis.keys.evicted (gauge) | The total number of keys evicted due to the maxmemory limit. Shown as key |
redis.keys.expired (gauge) | The total number of keys expired from the db. Shown as key |
redis.mem.fragmentation_ratio (gauge) | Ratio between used_memory_rss and used_memory. Shown as fraction |
redis.mem.lua (gauge) | Amount of memory used by the Lua engine. Shown as byte |
redis.mem.maxmemory (gauge) | Maximum amount of memory allocated to the Redisdb system. Shown as byte |
redis.mem.peak (gauge) | The peak amount of memory used by Redis. Shown as byte |
redis.mem.rss (gauge) | Amount of memory that Redis allocated as seen by the os. Shown as byte |
redis.mem.used (gauge) | Amount of memory allocated by Redis. Shown as byte |
redis.mem.startup (gauge) | Amount of memory consumed by Redis at startup. Shown as byte |
redis.mem.overhead (gauge) | Sum of all overheads allocated by Redis for managing its internal datastructures. Shown as byte |
redis.net.clients (gauge) | The number of connected clients (excluding slaves). Shown as connection |
redis.net.commands (gauge) | The number of commands processed by the server. Shown as command |
redis.net.commands.instantaneous_ops_per_sec (gauge) | The number of commands processed by the server per second. Shown as command |
redis.net.connections (gauge) | The number of connections tagged by client name. Shown as connection |
redis.net.rejected (gauge) | The number of rejected connections. Shown as connection |
redis.net.slaves (gauge) | The number of connected slaves. Shown as connection |
redis.net.maxclients (gauge) | The maximum number of connected clients. Shown as connection |
redis.perf.latest_fork_usec (gauge) | The duration of the latest fork. Shown as microsecond |
redis.persist (gauge) | The number of keys persisted (redis.keys - redis.expires). Shown as key |
redis.persist.percent (gauge) | Percentage of total keys that are persisted. Shown as percent |
redis.pubsub.channels (gauge) | The number of active pubsub channels. |
redis.pubsub.patterns (gauge) | The number of active pubsub patterns. |
redis.rdb.bgsave (gauge) | One if a bgsave is in progress and zero otherwise. |
redis.rdb.changes_since_last (gauge) | The number of changes since the last background save. |
redis.rdb.last_bgsave_time (gauge) | Duration of the last bg_save operation. Shown as second |
redis.replication.backlog_histlen (gauge) | The amount of data in the backlog sync buffer. Shown as byte |
redis.replication.delay (gauge) | The replication delay in offsets. Shown as offset |
redis.replication.last_io_seconds_ago (gauge) | Amount of time since the last interaction with master. Shown as second |
redis.replication.master_link_down_since_seconds (gauge) | Amount of time that the master link has been down. Shown as second |
redis.replication.master_repl_offset (gauge) | The replication offset reported by the master. Shown as offset |
redis.replication.slave_repl_offset (gauge) | The replication offset reported by the slave. Shown as offset |
redis.replication.sync (gauge) | One if a sync is in progress and zero otherwise. |
redis.replication.sync_left_bytes (gauge) | Amount of data left before syncing is complete. Shown as byte |
redis.slowlog.micros.95percentile (gauge) | The 95th percentile of the duration of queries reported in the slow log. Shown as microsecond |
redis.slowlog.micros.avg (gauge) | The average duration of queries reported in the slow log. Shown as microsecond |
redis.slowlog.micros.count (rate) | The rate of queries reported in the slow log. Shown as query |
redis.slowlog.micros.max (gauge) | The maximum duration of queries reported in the slow log. Shown as microsecond |
redis.slowlog.micros.median (gauge) | The median duration of queries reported in the slow log. Shown as microsecond |
redis.stats.keyspace_hits (gauge) | The rate of successful lookups in the main db. Shown as key |
redis.stats.keyspace_misses (gauge) | The rate of missed lookups in the main db. Shown as key |
redis.command.calls (gauge) | The number of times a redis command has been called, tagged by 'command', e.g. 'command:append'. Enable in Agent's redisdb.yaml with the command_stats option. |
redis.command.usec_per_call (gauge) | The CPU time consumed per redis command call, tagged by 'command', e.g. 'command:append'. Enable in Agent's redisdb.yaml with the command_stats option. |
The Redis check does not include any events.
redis.can_connect:
Returns CRITICAL
if the Agent cannot connect to Redis to collect metrics, otherwise returns OK
.
redis.replication.master_link_status:
Returns CRITICAL
if this Redis instance is unable to connect to its master instance, otherwise returns OK
.
redisdb
-------
- instance #0 [ERROR]: 'Error 111 connecting to localhost:6379. Connection refused.'
- Collected 0 metrics, 0 events & 1 service chec
Check that the connection info in redisdb.yaml
is correct.
redisdb
-------
- instance #0 [ERROR]: 'NOAUTH Authentication required.'
- Collected 0 metrics, 0 events & 1 service check
Configure a password
in redisdb.yaml
.
Additional helpful documentation, links, and articles: