Monitoring Redis with Prometheus and Grafana: Installation, Configuration, Visualization, and Alerting
This tutorial explains how to install Redis Exporter, configure Prometheus to scrape Redis metrics, visualize them in Grafana, and set up alert rules for Redis, providing step‑by‑step commands, configuration snippets, and screenshots for a complete monitoring solution.
Prometheus is an open‑source monitoring system that can collect rich metrics and trigger flexible alerts, making it suitable for real‑time monitoring of Redis instances.
1. Install Redis Exporter – Redis Exporter gathers Redis metrics via the INFO and STATS commands and exposes them in a Prometheus‑compatible format.
$ wget https://github.com/oliver006/redis_exporter/releases/download/v1.36.0/redis_exporter-v1.36.0.linux-amd64.tar.gz $ tar -xvf redis_exporter-v1.36.0.linux-amd64.tar.gz $ cd redis_exporter-v1.36.0.linux-amd64/ $ mv redis_exporter /usr/local/bin/
Start the exporter so it listens on the default port 9121:
$ redis_exporter -redis.addr localhost:6379 &
Use --redis.addr to specify the Redis address and add -redis.password <password> if authentication is required.
2. Configure Prometheus – Add a scrape job for Redis in prometheus.yml :
scrape_configs: - job_name: 'redis' scrape_interval: 5s static_configs: - targets: ['192.168.214.112:9121']
This configuration defines a job named redis that polls the exporter every five seconds.
Start Prometheus with the new configuration:
$ prometheus --config.file /etc/prometheus/prometheus.yml &
After Prometheus reloads, the Redis metrics will be collected and stored locally.
3. Visualize Metrics with Grafana – Add Prometheus as a data source, import a Redis dashboard template, and configure it to use the Prometheus source. The dashboard shows memory usage, command execution statistics, client connections, and persistence status.
4. Set Up Alerting – Define alert rules in Prometheus to detect abnormal Redis conditions, such as too many client connections:
groups: - name: redis_alerts rules: - alert: TooManyConnections # alert name expr: redis_connected_clients > 1000 # expression for: 5m # duration labels: severity: warning annotations: summary: "Too many connections (instance {{ $labels.instance }})" description: "Redis instance has too many connections\n VALUE = {{ $value }}\n LABELS = {{ $labels }}"
This rule triggers a warning when the number of connected clients exceeds 1000 for five minutes, helping operators respond quickly.
By following these steps, you can achieve end‑to‑end monitoring of Redis, from metric collection to visualization and automated alerting.
DevOps Operations Practice
We share professional insights on cloud-native, DevOps & operations, Kubernetes, observability & monitoring, and Linux systems.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.