13.1解压安装
tar -zxvf redis_exporter-v0.21.2.linux-amd64.tar.gz
groupadd prometheus2
useradd -g prometheus2 -m -d /home/monitor/node_exporter/ -s /sbin/nologin prometheus2
mv node_exporter-0.18.1.linux-amd64 node_exporter
rm -rf node_exporter-0.18.1.linux-amd64
13.2 自启动
./redis_exporter -h #查看信息
touch /usr/lib/systemd/system/redis_exporter.service
chown prometheus2:prometheus2 /usr/lib/systemd/system/redis_exporter.service
chown -R prometheus2:prometheus2 /home/monitor/redis_exporter
vim /usr/lib/systemd/system/redis_exporter.service
[Unit]
Description=redis_exporter
Documentation=https://github.com/oliver006/redis_exporter
After=network.target
[Service]
Type=simple
User=prometheus2
ExecStart=/home/monitor/redis_exporter/redis_exporter -redis.addr localhost:6379 -redis.password root
Restart=on-failure
[Install]
WantedBy=multi-user.target
启动
systemctl daemon-reload
systemctl enable redis_exporter.service
systemctl start redis_exporter.service
systemctl status redis_exporter.service
systemctl stop redis_exporter.service
systemctl restart redis_exporter.service
13.3 添加到Prometheus
-
job_name: '10.2_reids'
static_configs:
- targets: ['x.x.x.2:9121']
13.4 添加grafana
Import dashboard 763 选择数据源 Prometheus
image.png
网友评论