This guide will focus on monitoring of Redis application on a Linux server. Redis is an open source in-memory data structure store, used as a database, cache and message broker. Redis provides a distributed, in-memory key-value database with optional durability.

Redis supports different kinds of abstract data structures, such as strings, sets, maps, lists, sorted sets, spatial indexes, and bitmaps.

So far we have covered the following monitoring with Prometheus:

Monitoring Ceph Cluster with Prometheus and Grafana

How to Monitor Linux Server Performance with Prometheus and Grafana in 5 minutes

How to Monitor BIND DNS server with Prometheus and Grafana

Monitoring MySQL / MariaDB with Prometheus in five minutes

What’s exported by Redis exporter?

Most items from the INFO command are exported, see for details. In addition, for every database there are metrics for total keys, expiring keys and the average TTL for keys in the database.

You can also export values of keys if they’re in numeric format by using the -check-keys flag. The exporter will also export the size (or, depending on the data type, the length) of the key. This can be used to export the number of elements in (sorted) sets, hashes, lists, etc.

Setup Pre-requisite

  1. Installed Prometheus Server – Install Prometheus Server on CentOS 7 and Ubuntu 18.04
  2. Installed Grafana Data visualization & Monitoring – Install Prometheus Server on CentOS 7 and Ubuntu 18.04

Step 1: Download and Install Redis Prometheus exporter

This Prometheus exporter for Redis metrics supports Redis 2.x, 3.x, and 4.x

export VER="0.21.2"

Extract the downloaded archive file

tar xvf redis_exporter-v${VER}.linux-amd64.tar.gz
sudo mv redis_exporter /usr/local/bin/
rm -f redis_exporter-v${VER}.linux-amd64.tar.gz

redis_exporter should be executable from your current SHELL

$ redis_exporter  -version
INFO[0000] Redis Metrics Exporter v0.21.2    build date: 2018-09-20-18:15:12    sha1: 8bb0b841e9a70b0348f69483e58fea01d521c47a    Go: go1.10.4

To get a list of all options supported, pass --help option

# redis_exporter  --help
Usage of redis_exporter:
  -check-keys string
    	Comma separated list of key-patterns to export value and length/size, searched for with SCAN
  -check-single-keys string
    	Comma separated list of single keys to export value and length/size
    	Output verbose debug information
  -log-format string
    	Log format, valid options are txt and json (default "txt")
  -namespace string
    	Namespace for metrics (default "redis")
    	Whether to export go runtime metrics also
  -redis.addr string
    	Address of one or more redis nodes, separated by separator
  -redis.alias string
    	Redis instance alias for one or more redis nodes, separated by separator
  -redis.file string
    	Path to file containing one or more redis nodes, separated by newline. NOTE: mutually exclusive with redis.addr
  -redis.password string
    	Password for one or more redis nodes, separated by separator
  -script string
    	Path to Lua Redis script for collecting extra metrics
  -separator string
    	separator used to split redis.addr, redis.password and redis.alias into several elements. (default ",")
    	Use Cloud Foundry service bindings
    	Show version information and exit
  -web.listen-address string
    	Address to listen on for web interface and telemetry. (default ":9121")
  -web.telemetry-path string
    	Path under which to expose metrics. (default "/metrics")

Step 2: Create Prometheus redis exporter systemd service / Init script

The user prometheus will be used to run the service. Add Promethes system user if it doesn’t exist

sudo groupadd --system prometheus
sudo useradd -s /sbin/nologin --system -g prometheus prometheus

Then proceed to create a systemd service unit file.

sudo vim /etc/systemd/system/redis_exporter.service

Add below content


ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/usr/local/bin/redis_exporter \
  --log-format=txt \
  --namespace=redis \
  --web.listen-address=:9121 \



For Init system

Install daemonize ( CentOS / Ubuntu )

sudo yum -y install daemonize
sudo apt-get install daemonize

Create init script

sudo vim /etc/init.d/redis_exporter


# Author: Josphat Mutai, [email protected] ,
# redis_exporter     This shell script takes care of starting and stopping Prometheus redis exporter 
# chkconfig: 2345 80 80
# description: Prometheus redis exporter  start script
# processname: redis_exporter
# pidfile: /var/run/

# Source function library.
. /etc/rc.d/init.d/functions


# GO CPU core Limit

#GOMAXPROCS=$(grep -c ^processor /proc/cpuinfo)

# Source config


start() {
    if [[ -f $PIDFILE ]] > /dev/null; then
        echo "redis_exporter  is already running"
        exit 0

    echo -n "Starting redis_exporter  service…"
    daemonize -u ${USER} -p ${PIDFILE} -l ${LOCKFILE} -a -e ${LOGFILE} -o ${LOGFILE} ${PROG} ${ARGS}
    echo ""
    return $RETVAL

stop() {
    if [ ! -f "$PIDFILE" ] || ! kill -0 $(cat "$PIDFILE"); then
        echo "Service not running"
        return 1
    echo 'Stopping service…'
    #kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
    killproc -p ${PIDFILE} -d 10 ${PROG}
    [ $RETVAL = 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
    return $RETVAL

status() {
    if [ -f "$PIDFILE" ] || kill -0 $(cat "$PIDFILE"); then
      echo "redis exporter  service running..."
      echo "Service PID: `cat $PIDFILE`"
      echo "Service not running"
     return $RETVAL

# Call function
case "$1" in
        echo "Usage: $0 {start|stop|restart}"
        exit 2

Create Arguments configuration file

sudo vim /etc/sysconfig/redis_exporter

Define used command Arguments

ARGS="--log-format=txt \
--namespace=redis \
--web.listen-address=:9121 \

Test the script

# /etc/init.d/redis_exporter
Usage: /etc/init.d/redis_exporter {start|stop|restart}

Step 3: Start Redis Prometheus exporter and enable service to start on boot

For a Systemd server, use systemctl command

sudo systemctl enable redis_exporter
sudo systemctl start redis_exporter

For SysV Init system, use

sudo /etc/init.d/redis_exporter start
sudo chkconfig redis_exporter on

You can verify that the service is running using

$ sudo /etc/init.d/redis_exporter status
redis exporter  service running...
Service PID: 27106

$ sudo chkconfig --list | grep redis_exporter
redis_exporter 0:off   1:off   2:on    3:on    4:on    5:on    6:off

$ sudo ss -tunelp | grep 9121
tcp    LISTEN     0      128                   :::9121                 :::*      users:(("redis_exporter",1970,6)) ino:1823474168 sk:ffff880341cd7800

Step 4: Add exporter job to Prometheus

The last step is to add a job to the Prometheus server for scraping metrics. Edit /etc/prometheus/prometheus.yml

# Redis Servers
  - job_name:
      - targets: ['']

  - job_name:
      - targets: ['']

Restart prometheus service for scraping of data metrics to begin

sudo systemctl restart prometheus

Test access to port 9121 from Prometheus server, it should be able to connect.

$ telnet 9121
Connected to
Escape character is '^]'.

If it can’t connect, check your Service port and firewall.

Step 5: Add Dashboard to Grafana

Add Prometheus data source to Grafana and import or create a grafana dashboard for Redis.

Grafana dashboard is available on and/or My Job configuration uses an alias, I’ll use Grafana dashboard with host & alias selector is available on

Download the dashboard json file


On Grafana UI, go to Create > Import Dashboard > Upload .json File. Select downloaded json file and click “Import“.

prometheus redis import dashboard min

Wait for data to start appearing on your Grafana Dashboard, below is a sample view

prometheus redis dashboard min

Enjoy using Grafana to monitor your Redis server(s).

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here