Operations 5 min read

How to Build a Real-Time Redis Monitoring Dashboard with Grafana and Prometheus

Learn step‑by‑step how to deploy redis‑exporter, configure Prometheus to scrape Redis metrics, and create a comprehensive Grafana dashboard, enabling you to instantly visualize Redis performance, detect issues early, and maintain high availability in fast‑paced internet environments.

Linux Ops Smart Journey
Linux Ops Smart Journey
Linux Ops Smart Journey
How to Build a Real-Time Redis Monitoring Dashboard with Grafana and Prometheus

In today's fast‑paced internet environment, Redis is widely used as a high‑performance key‑value store for caching, message queues, and more. Real‑time monitoring of its performance metrics is essential. Grafana, an open‑source visualization tool, helps build a Redis monitoring dashboard.

1. Deploy redis‑exporter

<code>$ curl -O https://github.com/oliver006/redis_exporter/releases/download/v1.66.0/redis_exporter-v1.66.0.linux-amd64.tar.gz</code>
<code>$ tmpdir=$(mktemp -d)
$ tar xvf redis_exporter-v1.66.0.linux-amd64.tar.gz -C ${tmpdir}
$ sudo mv ${tmpdir}/redis_exporter*/redis_exporter /usr/local/bin/</code>
<code>$ cat <<'EOF' | sudo tee /usr/lib/systemd/system/redis_exporter.service > /dev/null
[Unit]
Description=redis_exporter
Documentation=https://github.com/oliver006/redis_exporter
Wants=network.service
After=network.service

[Service]
Type=simple
User=postgres
Environment=REDIS_PASSWORD=123456
ExecStart=/usr/local/bin/redis_exporter
ExecStop=/bin/kill -s SIGTERM $MAINPID
Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

$ sudo systemctl daemon-reload
$ sudo systemctl enable redis_exporter --now
Created symlink from /etc/systemd/system/multi-user.target.wants/redis_exporter.service to /usr/lib/systemd/system/redis_exporter.service.</code>
<code>$ rm -rf ${tmpdir}</code>

2. Let Prometheus scrape Redis metrics

<code>$ kubectl -n kube-system edit cm prometheus
    - job_name: "redis-exporter"
      static_configs:
      - targets:
        - "172.139.20.81:9121"
        - "172.139.20.177:9121"</code>
<code>$ curl -s $(kubectl -n kube-system get svc prometheus -ojsonpath='{.spec.clusterIP}:{.spec.ports[0].port}')/prometheus/api/v1/query --data-urlencode 'query=up{job="redis-exporter"}'
{"status":"success","data":{"resultType":"vector","result":[{"metric":{"__name__":"up","instance":"172.139.20.177:9121","job":"redis-exporter"},"value":[1731982902.844,"1"]},{"metric":{"__name__":"up","instance":"172.139.20.81:9121","job":"redis-exporter"},"value":[1731982902.844,"1"]}]}}</code>

3. Add Redis dashboard to Grafana

Import the Redis overview dashboard (ID: 18345) from Grafana.com.

Conclusion

By following these steps you can quickly set up a powerful, easy‑to‑understand Redis monitoring panel in Grafana, improving observability and allowing proactive actions before issues arise, thus ensuring business continuity and stability.

MonitoringoperationsRedisPrometheusGrafana
Linux Ops Smart Journey
Written by

Linux Ops Smart Journey

The operations journey never stops—pursuing excellence endlessly.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.