Redis monitoring integration

Our Redis integration reports critical performance data from your Redis server to New Relic products. You can view this metric data and inventory data in pre-built dashboards, create alert policies, and create custom queries and charts. You can also specify keys that are important to your application and get information about their length.

Read on to install the integration, and to see what data we collect.

Compatibility and requirements

Our integration is compatible with Redis versions 3.0 or higher.

Before installing the integration, make sure that you meet the following requirements:

The integration obtains data by executing Redis commands:

  • INFO command: Data from the INFO command populates metric data and some inventory data.

  • CONFIG GET command: Most inventory data comes from this command.
    • In managed Redis installations without permissions to execute the CONFIG command (for example, AWS ElastiCache), the execution of this command can be disabled with the config_inventory: false configuration option.
  • Key length acquisition: Depending on the type of key, these commands are used:

For key length data collection, the agent uses pipelining to minimize the impact on your Redis performance. However, if you are collecting the length of many keys, your Redis performance may be affected. For this reason, the agent includes a default key limit (but this limit can be overwritten).

If you edited the names of the Redis commands mentioned above, the integration will not be able to retrieve the Redis data.

Install and activate

To install the Redis integration, follow the instructions for your environment:

ECS

See Monitor service running on ECS.

Kubernetes

See Monitor service running on Kubernetes.

Linux
  1. Follow the instructions for installing an integration, using the file name nri-redis.

  2. Change the directory to the integrations configuration folder:

    cd /etc/newrelic-infra/integrations.d
    
  3. Copy the sample configuration file:

    sudo cp redis-config.yml.sample redis-config.yml
    
  4. Edit the redis-config.yml file based on your Redis server connection methods:

    Connect with Unix socket

    If you connect using Unix socket, specify the unix_socket_path in the configuration file. If there are more than one Redis instance using Unix sockets, make sure to set use_unix_socket to true in the configuration file.

    Be sure that the user executing the Redis integration has correct permissions for accessing that Unix socket. The permissions of the Unix socket are set in the Redis configuration (value of unixsocketperm).

    Connect with TCP

    If you connect via TCP, the config file is by default set to localhost and port 6379. You can change this by specifying hostname and/or the port argument. If you use this method, the unix_socket_path parameter cannot be set.

  5. If required, set other configuration file settings based on your Redis setup, as described in Configuration.
  6. Restart the infrastructure agent.

Additional notes:

Configure the integration

An integration's YAML-format configuration is where you can place required login credentials and configure how data is collected. Which options you change depend on your setup and preference.

There are several ways to configure the integration, depending on how it was installed:

Config commands include:

metrics

metrics reports the metric data and accepts the following arguments:

  • hostname: Redis server hostname. Default value: localhost.
  • port: port where Redis server is listening. Default value: 6379.
  • unix_socket_path: Unix socket path on which Redis server is listening (if set). Default value: None.
  • use_unix_socket: uses the unix_socket_path value to help you to uniquely identify the Redis instances when there are more than one on the same host using Unix sockets. Default value: false.
  • keys: list of the keys for retrieving their lengths. Default value: None. See keyspace config for more information.
  • keys_limit: max number of the keys to retrieve their lengths. Default value: 30. For more information, see About this integration and Keyspace metrics configuration.
  • password: password to use when connecting to the Redis server. Use only if your Redis server is password-protected. Default value: None.
  • config_inventory: set it to false to avoid invoking the CONFIG GET Redis command. This option is useful in managed environments without permissions to execute the CONFIG command (for example, AWS ElastiCache). Default value: true
inventory

inventory captures all the Redis configuration parameters, with the exception of requirepass. To disable collection of inventory data, delete the inventory command from the config file.

keyspace

If you want to see metrics related to the length of selected keys, specify the keys parameter in single-line JSON format in redis-config.yml. For example:

keys: '{"0":["KEY_1"],"1":["KEY_2"]}'

If your selected keys are stored only in Redis database 0, then you can set the keys parameter as follows:

keys: '["KEY_1","KEY_2"]'

The keys_limit parameter defaults to 30 for performance reasons. Be aware that increasing this number could have a substantial impact on your Redis server performance.

To see the keyspace metric data that is collected, see RedisKeyspaceSample.

Activate remote monitoring

The remote_monitoring parameter enables remote monitoring and multi-tenancy for this integration.

Activating remote_monitoring may change some attributes and/or affect your configured alerts. For more information, see remote monitoring in on-host integrations.

Infrastructure agent version 1.2.25 or higher is required to use remote_monitoring.

Environment variable passthroughs

Environment variables can be used to control config settings, and are then passed through to the infrastructure agent. For instructions on how to use this feature, see Configure the infrastructure agent.

With secrets management, you can configure on-host integrations with New Relic infrastructure's agent to use sensitive data (such as passwords) without having to write them as plain text into the integration's configuration file. For more information, see Secrets management.

HOSTNAME

Redis server hostname.

Type String
Default localhost

Example:

HOSTNAME='Redis DB'
PORT

The port where Redis server is listening.

Type Integer
Default 6379

Example:

PORT=7199
UNIX_SOCKET_PATH

Unix socket path on which Redis server is listening (if set).

Type String
Default (none)

Example:

UNIX_SOCKET_PATH='tpf_unix_sock.server'
KEYS

List of the keys for retrieving their lengths.

Type JSON
Default (none)

Example:

KEYS='{"0":["KEY_1"],"1":["KEY_2"]}'
KEYS_LIMIT

Max number of the keys to retrieve their lengths.

Type Integer
Default 30

Example:

KEYS_LIMIT=50
PASSWORD

Password to use when connecting to the Redis server.

Type String
Default (none)

Example:

PASSWORD='Hhv*$jIV'

For more about the general structure of on-host integration configuration, see Configuration.

Find and use data

Data from this service is reported to an integration dashboard.

Metrics are attached to the RedisSample and RedisKeyspaceSample event types. You can query this data for troubleshooting purposes or to create custom charts and dashboards.

For more on how to find and use your data, see Understand integration data.

Metric data

The Redis integration collects the following metric data attributes:

These attributes are attached to the RedisSample event type:

Name Description
cluster.connectedSlaves Number of connected slaves.
db.aofLastRewriteTimeInMilliseconds Duration of the last AOF rewrite operation in milliseconds.
db.aofLastBgrewriteStatus Boolean representing status of the last AOF background rewrite operation.
db.aofLastWriteStatus Boolean representing status of the last AOF write operation.
db.evictedKeysPerSecond Number of evicted keys due to maxmemory limit per second.
db.expiredKeysPerSecond Number of key expiration events per second.
db.keyspaceHitsPerSecond Number of successful lookups of keys in the main dictionary per second.
db.keyspaceMissesPerSecond Number of failed lookup of keys in the main dictionary per second.
db.latestForkUsecMilliseconds Duration of the latest fork operation in milliseconds.
db.rdbBgsaveInProgress Boolean. A flag indicating a RDB save is ongoing.
db.rdbChangesSinceLastSave Number of changes since the last dump.
db.rdbLastBgsaveStatus Boolean representing the status of the last RDB save operation.
db.rdbLastBgsaveTimeMilliseconds Duration of the last RDB save operation in milliseconds.
db.rdbLastSaveTime Epoch-based timestamp of last successful RDB save in seconds.
db.syncFull Count of the number times slaves have fully synchronized with this master.
db.syncPartialErr Count of the number of times partial syncs have failed to complete.
db.syncPartialOk Count of the number of times partial syncs have completed.
net.blockedClients Number of clients pending on a blocking call (BLPOP, BRPOP, BRPOPLPUSH).
net.clientBiggestInputBufBytes The biggest input buffer among current client connections.
net.clientLongestOutputList The longest output list among current client connections.
net.commandsProcessedPerSecond Number of commands processed by the server per second.
net.connectedClients Number of client connections (excluding connections from slaves).
net.connectionsReceivedPerSecond Number of connections accepted by the server per second.
net.inputBytesPerSecond Total number of bytes input per second.
net.outputBytesPerSecond Total number of bytes output per second.
net.pubsubChannels Global number of pub/sub channels with client subscriptions.
net.pubsubPatterns Global number of pub/sub pattern with client subscriptions.
net.rejectedConnectionsPerSecond Number of connections per second rejected because of maxclients limit.
software.uptimeMilliseconds Number of milliseconds since Redis server start.
system.memFragmentationRatio Ratio between used_memory_rss and used_memory.
system.totalSystemMemoryBytes The amount of memory in bytes available in the instance where Redis is running.
system.usedCpuSysMilliseconds System CPU consumed by the Redis server in milliseconds.
system.usedCpuSysChildrenMilliseconds System CPU consumed by the background processes in milliseconds.
system.usedCpuUserMilliseconds User CPU consumed by the Redis server in milliseconds.
system.usedCpuUserChildrenMilliseconds User CPU consumed by the background processes in milliseconds.
system.usedMemoryBytes The total number of bytes allocated by Redis using its allocator (either standard libc, jemalloc, or an alternative allocator such as tcmalloc).
system.usedMemoryLuaBytes Number of bytes used by the Lua engine.
system.usedMemoryPeakBytes The peak memory consumed by Redis in bytes.
system.usedMemoryRssBytes Number of bytes that Redis allocated as seen by the operating system (also known as resident set size). This is the number reported by tools such as top(1) and ps(1).

The Redis integration collects the following keyspace metadata and metrics. These attributes are attached to the RedisKeyspaceSample event type:

Name Description
db.avgTtl The average time to live (TTL) in milliseconds of keys that have an expiration set in the database being reported on.
db.keys Number of keys in the database being reported on.
db.keyspace Redis database index, which is the integer number (usually a number between 0 and 15). Format: db followed by the database index. For example: db0, db1, db2, etc.
db.expires Number of keys with an expiration in the database being reported on.

Inventory data

Inventory data includes everything reported by the Redis CONFIG GET command, with the exception of requirepass, which stores the password to the Redis server. For more on inventory data, see Understand inventory data.

Other system data

The Redis integration collects these additional attributes about your Redis service:

Name Description
software.version The version of the Redis server. Example: 3.2.3.
cluster.role Either master or slave, depending on the role of the Redis node being monitored.

Check the source code

This integration is open source software. That means you can browse its source code and send improvements, or create your own fork and build it.

For more help

If you need more help, check out these support and learning resources: