【Prometheus】Prometheus - Exporter - Redis Exporter

Posted by 西维蜀黍 on 2020-07-23, Last Modified on 2022-04-03

Build and run locally

$ git clone https://github.com/oliver006/redis_exporter.git
$ cd redis_exporter
$ go build .
$ nohup /home/sw/redis_exporter/redis_exporter &

开机运行

$ sudo vim /etc/systemd/system/redis_exporter.service
[Unit]
Description=redis exporter
After=network.target

[Service]
Type=simple
ExecStart=/home/sw/redis_exporter/redis_exporter

[Install]
WantedBy=multi-user.target


$ sudo systemctl enable redis_exporter.service; sudo systemctl start redis_exporter.service; sudo systemctl status redis_exporter.service

Basic Prometheus Configuration

Add a block to the scrape_configs of your prometheus.yml config file:

scrape_configs:
  - job_name: redis_exporter
    static_configs:
    - targets: ['<<REDIS-EXPORTER-HOSTNAME>>:9121']

and adjust the host name accordingly.

See Metrics from Grafana

Grafana Dashboard for Redis: https://grafana.com/grafana/dashboards/763

Trigger some Redis call:

$ redis-benchmark -n 1000000 -r 10000000 -q -h 192.168.2.204

Reference