How to monitor Redis with Prometheus and Grafana | Docker

How to monitor Redis with Prometheus and Grafana

For this example we will use Docker compose to be able to run all the services

  1. Docker Compose
version: "3.9"
services:
grafana:

image: grafana/grafana
ports:
- 3000:3000
prometheus:
image:
prom/prometheus
ports:
- 9090:9090
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
redis:
image:
"bitnami/redis:latest"
ports:
- 6379:6379
environment:
- REDIS_REPLICATION_MODE=master
- REDIS_PASSWORD=my_master_password
redis-exporter:
image:
oliver006/redis_exporter
ports:
- 9121:9121
environment:
REDIS_ADDR: "redis:6379"
REDIS_USER: null
REDIS_PASSWORD: my_master_password
links:
- redis
- prometheus

2.Prometheus File Settings (prometheus.yml)

global:
scrape_interval:
15s
evaluation_interval: 15s
scrape_configs:
- job_name:
prometheus
static_configs:
- targets:
['localhost:9090']
- job_name: redis-exporter
static_configs:
- targets: ['redis-exporter:9121']

3.Run Docker Compose

docker-compose up

Code of example (GitHub Gist)
https://gist.github.com/nelsoncode019/722727fdba11d846e39dc99f8064f7fe

4.Check status of Prometheus and Redis Exporter

http://localhost:9090/targets

5.Visit Grafana Dashboard

Default

User: admin
Password: admin

http://localhost:3000

6.Add data source

Save and test

7.Import Redis Dashboard for Prometheus

For this we will use a Dashboard created by the community

https://grafana.com/grafana/dashboards/763

8.Import JSON of code

Code: 763

JSON:
https://grafana.com/api/dashboards/763/revisions/3/download

9.Dashboard

Code of example (GitHub Gist)
https://gist.github.com/nelsoncode019/722727fdba11d846e39dc99f8064f7fe

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store