Menu
Grafana Cloud

Redis integration for Grafana Cloud

Redis is an in-memory data structure store frequently used as a key-value data store, cache, and message broker.

This integration includes 6 useful alerts and 1 pre-built dashboard to help monitor and visualize Redis metrics.

Before you begin

A user must be created in Redis for Grafana Alloy in order to connect to the cluster. We strongly recommend that you configure a separate user for the Agent, and give it only the strictly mandatory security privileges necessary for monitoring your node, as per the official documentation.

Install Redis integration for Grafana Cloud

  1. In your Grafana Cloud stack, click Connections in the left-hand menu.
  2. Find Redis and click its tile to open the integration.
  3. Review the prerequisites in the Configuration Details tab and set up Grafana Agent to send Redis metrics to your Grafana Cloud instance.
  4. Click Install to add this integration’s pre-built dashboard and alerts to your Grafana Cloud instance, and you can start monitoring your Redis setup.

Configuration snippets for Grafana Alloy

Simple mode

These snippets are configured to scrape a single Redis instance running locally with default ports.

First, manually copy and append the following snippets into your alloy configuration file.

Integrations snippets

alloy
prometheus.exporter.redis "integrations_redis_exporter" {
	redis_addr = "localhost:6379"
}

discovery.relabel "integrations_redis_exporter" {
	targets = prometheus.exporter.redis.integrations_redis_exporter.targets

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}

	rule {
		target_label = "job"
		replacement  = "integrations/redis_exporter"
	}
}

prometheus.scrape "integrations_redis_exporter" {
	targets    = discovery.relabel.integrations_redis_exporter.output
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/redis_exporter"
}

Advanced mode

The following snippets provide examples to guide you through the configuration process.

To instruct Grafana Alloy to scrape your Redis instances, manually copy and append the snippets to your alloy configuration file, then follow subsequent instructions.

Advanced integrations snippets

alloy
prometheus.exporter.redis "integrations_redis_exporter" {
	redis_addr = "localhost:6379"
}

discovery.relabel "integrations_redis_exporter" {
	targets = prometheus.exporter.redis.integrations_redis_exporter.targets

	rule {
		target_label = "instance"
		replacement  = constants.hostname
	}

	rule {
		target_label = "job"
		replacement  = "integrations/redis_exporter"
	}
}

prometheus.scrape "integrations_redis_exporter" {
	targets    = discovery.relabel.integrations_redis_exporter.output
	forward_to = [prometheus.remote_write.metrics_service.receiver]
	job_name   = "integrations/redis_exporter"
}

This integrations uses the prometheus.exporter.redis component to generate metrics from a Redis instance.

Make sure to change the redis_addr to the addresses of the Redis server you want to monitor in the agent config.

For the full array of configuration options, refer to the prometheus.exporter.redis component reference documentation.

This exporter must be linked with a discovery.relabel component to apply the necessary relabelings.

For each Redis instance to be monitored you must create a pair of these components.

Configure the following properties within each discovery.relabel component:

  • instance label: constants.hostname sets the instance label to your Grafana Alloy server hostname. If that is not suitable, change it to a value uniquely identifies this Redis instance.

You can then scrape them by including each discovery.relabel under targets within the prometheus.scrape component.

Grafana Agent static configuration (deprecated)

The following section shows configuration for running Grafana Agent in static mode which is deprecated. You should use Grafana Alloy for all new deployments.

Dashboards

The Redis integration installs the following dashboards in your Grafana Cloud instance to help monitor your system.

  • Redis Dashboard for Prometheus Redis Exporter 1.x

Overview

Overview

Alerts

The Redis integration includes the following useful alerts:

AlertDescription
RedisDownCritical: Redis down (instance {{ $labels.instance }})
RedisOutOfMemoryWarning: Redis out of memory (instance {{ $labels.instance }})
RedisTooManyConnectionsWarning: Redis too many connections (instance {{ $labels.instance }})
RedisClusterSlotFailWarning: Number of hash slots mapping to a node in FAIL state (instance {{ $labels.instance }})
RedisClusterSlotPfailWarning: Number of hash slots mapping to a node in PFAIL state (instance {{ $labels.instance }})
RedisClusterStateNotOkCritical: Redis cluster state is not ok (instance {{ $labels.instance }})

Metrics

The most important metrics provided by the Redis integration, which are used on the pre-built dashboard and Prometheus alerts, are as follows:

  • redis_blocked_clients
  • redis_cluster_slots_fail
  • redis_cluster_slots_pfail
  • redis_cluster_state
  • redis_commands_duration_seconds_total
  • redis_commands_total
  • redis_connected_clients
  • redis_connected_slaves
  • redis_db_keys
  • redis_db_keys_expiring
  • redis_evicted_keys_total
  • redis_keyspace_hits_total
  • redis_keyspace_misses_total
  • redis_master_last_io_seconds_ago
  • redis_memory_fragmentation_ratio
  • redis_memory_max_bytes
  • redis_memory_used_bytes
  • redis_memory_used_rss_bytes
  • redis_total_system_memory_bytes
  • redis_up
  • up

Changelog

md
# 0.0.6 - November 2023

* Replaced Angular dashboard panels with React panels

# 0.0.5 - July 2023

* New Filter Metrics option for configuring the Grafana Agent, which saves on metrics cost by dropping any metric not used by this integration. Beware that anything custom built using metrics that are not on the snippet will stop working.
* New hostname relabel option, which applies the instance name you write on the text box to the Grafana Agent configuration snippets, making it easier and less error prone to configure this mandatory label.

# 0.0.4 - May 2023

* Update mixin to latest version:
  - Add RedisClusterSlot alerts
  
# 0.0.3 - May 2022

* Update mixin to latest version:
  - Fix selector

# 0.0.2 - October 2021

* Update mixin to latest version:
  - Update queries to use $__rate_interval

# 0.0.1 - October 2020

* Initial release

Cost

By connecting your Redis instance to Grafana Cloud, you might incur charges. To view information on the number of active series that your Grafana Cloud account uses for metrics included in each Cloud tier, see Active series and dpm usage and Cloud tier pricing.