参考:Prometheus+Grafana学习(十)监控Redis_码农-文若书生的博客-CSDN博客_prometheus+grafana监控redis
下载地址:Releases · oliver006/redis_exporter (github.com)

安装

  1. 下载:wget https://github.com/oliver006/redis_exporter/releases/download/v1.44.0/redis_exporter-v1.44.0.linux-amd64.tar.gz

  2. 解压:tar -zxvf redis_exporter-v1.44.0.linux-amd64.tar.gz

  3. 注册系统服务:vim /etc/systemd/system/redis_node_exporter.service

    [Service]
    WorkingDirectory=/opt/sofeware/redis_exporter/
    PrivateTmp=true
    Restart=always
    Type=simple
    ExecStart=/opt/sofeware/redis_exporter/redis_exporter -redis.addr=localhost:6379 -redis.password=你的redis密码
    ExecStop=/usr/bin/kill -9 $MAINPID

    [Install]
    WantedBy=multi-user.target
  4. 设置启动项

    systemctl daemon-reload
    systemctl enable redis_node_exporter.service
    systemctl start redis_node_exporter.service
    systemctl status redis_node_exporter.service

测试

代码:curl localhost:9121/metrics

成功::注意放行防火墙端口!!

配置Prometheus

修改Prometheus配置文件:vim /opt/sofeware/prometheus/prometheus.yml

scrape_configs:
  - job_name: 'redis-vitral'
    static_configs:
    - targets: ['192.168.0.7:9121']

配置Grafana

  1. 下载模板:Redis Dashboard for Prometheus Redis Exporter (helm stable/redis-ha) | Grafana Labs
  2. 导入模板:11835

点击Import导入,导入成功如下: