Skip to content

Instantly share code, notes, and snippets.

@nelsondev19
Last active April 12, 2024 08:18
Show Gist options
  • Save nelsondev19/722727fdba11d846e39dc99f8064f7fe to your computer and use it in GitHub Desktop.
Save nelsondev19/722727fdba11d846e39dc99f8064f7fe to your computer and use it in GitHub Desktop.
How to monitor Redis with Prometheus and Grafana | Docker
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
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']
@nelsondev19
Copy link
Author

Run Docker Compose

docker-compose up

Check status of Prometheus and Redis Exporter

http://localhost:9090/targets

Image description

Visit Grafana Dashboard

Default

User: admin
Password: admin

http://localhost:3000

Image description

Add data source

Image description

Save and test

Image description

Import Redis Dashboard for Prometheus

For this we will use a Dashboard created by the community

Redis Dashboard for Prometheus

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

Import JSON of code

Image description

Import JSON of code

Code: 763

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

Dashboard

Image description

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment