prometheus之监控redis

@admin  May 11, 2020

安装部署

[root@mysql01 opt]# wget https://github.com/oliver006/redis_exporter/releases/download/v1.5.2/redis_exporter-v1.5.2.linux-arm64.tar.gz
[root@mysql01 opt]# tar -zxvf redis_exporter-v1.5.2.linux-arm64.tar.gz
[root@mysql01 opt]# mv redis_exporter-v1.5.2.linux-arm64 /usr/local/redis_exporter
[root@mysql01 opt]# cd /usr/local/redis_exporter
[root@mysql01 opt]# ll
 total 8500
 -rw-r--r--. 1 root root    1063 Feb 22 02:08 LICENSE
 -rw-r--r--. 1 root root   10757 Feb 22 02:08 README.md
 -rwxr-xr-x. 1 root root 8687616 Feb 22 02:07 redis_exporter

测试启动

[root@mysql01 opt]# /usr/local/redis_exporter/redis_exporter -redis.addr 127.0.0.1:6379 
INFO[0000] Redis Metrics Exporter v1.4.0    build date: 2020-02-22-02:07:24    sha1: dde61ca2367f5fdb1f4a0c49022fcb0135715d22    Go: go1.13.8    GOOS: linux    GOARCH: amd64 
INFO[0000] Providing metrics at :9121/metrics   

配置进程守护

[root@mysql01 opt]# vim /usr/lib/systemd/system/redis_exporter.service 
[Unit]
Description=redis_exporter
After=network.target

[Service]
Restart=on-failure
ExecStart=/usr/local/redis_exporter/redis_exporter -redis.addr 127.0.0.1:6379

[Install]
WantedBy=multi-user.target

配置server端

进入server端所在服务器,修改prometheus.yml配置文件,添加一个job配置项,然后重新启动prometheus server端。

[root@devops prometheus-2.15.1.linux-amd64]# vim prometheus.yml
...
 - job_name: 'redis'
static_configs:
- targets:
  - "192.168.3.100:9121"

配置grafna

配置prometheus数据源,添加prometheus插件,下载redis仪表盘模板,选择prometheus数据源,然后上传json文件,下载地址: https://grafana.com/grafana/dashboards/763/revisions 或者直接import 763号模板。


添加新评论