prometheus监控redis

下载redis_exporter插件

代理插件不必定非要安装在redis端linux

wget https://github.com/oliver006/redis_exporter/releases/download/v0.30.0/redis_exporter-v0.30.0.linux-amd64.tar.gz

解压

tar xf redis_exporter-v0.30.0.linux-amd64.tar.gz

启动redis_exporter登录redis

## 无密码
nohup ./redis_exporter -redis.addr 192.168.1.120:6379 &
## 有密码
nohup ./redis_exporter  -redis.addr 192.168.1.120:6379  -redis.password 123456

redis默认端口是6379
git

查看redis_exporte是否开启

netstat -lntp
tcp6       0      0 :::9121               :::*              LISTEN      32407/redis_exporte

修改prometheus配置文件

vim prometheus.yml
 - job_name: 'redis'
    static_configs:
    - targets:
      - "localhost:9121"   #redis_exporte在哪台服务器启动的就填哪台服务器ip

重启prometheus

nohup ./prometheus --config.file=./prometheus.yml &

grafana配置

配置prometheus数据源
添加prometheus插件,而后配置

image.png
image.png
image.png

github

下载redis仪表盘模板

 https://grafana.com/dashboards/763/revisions
image.png
redis

导入模板

选区_004.png
image.png

参考文献:

https://github.com/oliver006/redis_exporter?spm=a2c4e.11153940.blogcont251478.18.6156d4895PIlpcvim