Redis 接入 Prometheus 监控系统
系列文章目录
- Prometheus 的安装部署
- Grafana的安装部署
- Linux服务器接入Prometheus监控-Node Exporter 安装指南
- Prometheus 接入SpringBoot微服务监控
- Mysql 接入 Prometheus
- RocketMQ 接入Prometheus 监控
- ElasticSearch 接入 Prometheus
- Nacos 接入 Prometheus 监控
- Redis 接入 Prometheus 监控系统
- Prometheus + Grafana 监控系统-告警规则配置
- Prometheus + Grafana 监控系统-PrometheusAlert安装与配置指南
-
下载安装
- 最新版下载地址: https://github.com/oliver006/redis_exporter/releases
cd /home/work/software/ wget https://github.com/oliver006/redis_exporter/releases/download/v1.61.0/redis_exporter-v1.61.0.linux-amd64.tar.gztar -xzvf redis_exporter-*.linux-amd64.tar.gz# 改名-可选 #mv redis_exporter-v1.61.0.linux-amd64 redis_exporter
-
注册成一个service
useradd redis_exporter vim /etc/systemd/system/redis_exporter.service# 内容如下: [Unit] Description=Redis Exporter After=network.target[Service] User=redis_exporter ExecStart=/home/work/software/redis_exporter/redis_exporter \ -redis.addr 127.0.0.1:6379 \ -redis.password abcdefg \ -ping-on-connect \ -export-client-list \ -web.listen-address=0.0.0.0:9121 ExecReload=/bin/kill -HUP Restart=on-failure[Install] WantedBy=multi-user.target
-
管理 redis_exporter 服务
sudo systemctl daemon-reload sudo systemctl enable redis_exporter sudo systemctl start redis_exporter # 查看效果curl http://localhost:9121/metrics
-
注意:
-
如果报错: redis_exporter[4304]: time=“2024-07-01T15:40:34+08:00” level=error msg=“Couldn’t connect to redis instance ()”
- 解决方案: 如果密码正确,那么有可能是 -redis.addr 参数问题,host 要跟 ps -ef | grep redis 中显示的 host 一致
-
-
集成到Prometheus - prometheus.yml 增加如下配置即可
scrape_configs- job_name: "redis_exporter"static_configs:- targets: ["xxx-redis:9121"]
-
Grafana 添加对应仪表盘
- 官方版本: https://grafana.com/grafana/dashboards/763-redis-dashboard-for-prometheus-redis-exporter-1-x/