赞
踩
下载地址:
https://github.com/oliver006/redis_exporter/releases
tar -xvf redis_exporter-v1.55.0.linux-amd64.tar.gz -C /usr/local/
cd /usr/local/
mv redis_exporter-v1.55.0.linux-amd64/ redis_exporter
cd /usr/local/redis_exporter
nohup ./redis_exporter -redis.addr 172.20.2.18:6379 &
nohup ./redis_exporter -redis.addr 172.20.2.18:6380 &
多实例(有密码)
cd /usr/local/redis_exporter
nohup ./redis_exporter -redis.addr 172.2.1.3:6380 --redis.password=oj+xjlARRfJqbC+A --web.listen-address=:9120 &
nohup ./redis_exporter -redis.addr 172.2.1.3:6381 --redis.password=oj+xjlARRfJqbC+A --web.listen-address=:9121 &
cat > /etc/systemd/system/redis_exporter.service << "EOF"
[Unit]
Description=redis_exporter
After=local-fs.target network-online.target network.target
Wants=local-fs.target network-online.target network.target
[Service]
ExecStart=/usr/local/redis_exporter/redis_exporter -redis.addr 172.22.201.32:6380
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
cat > /etc/systemd/system/redis_exporter.service << "EOF"
[Unit]
Description=redis_exporter
After=local-fs.target network-online.target network.target
Wants=local-fs.target network-online.target network.target
[Service]
ExecStart=/usr/local/bin/redis_exporter -redis.addr 172.22.201.32:6380 --redis.password=oj+xjlARRfJqbC+A --web.listen-address=:9120
ExecStart=/usr/local/bin/redis_exporter -redis.addr 172.22.201.32:6381 --redis.password=oj+xjlARRfJqbC+A --web.listen-address=:9121
Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable redis_exporter
systemctl start redis_exporter
systemctl status redis_exporter
vim prometheus.yaml #监控redis_cluster集群 - job_name: 'redis_exporter_cluster' static_configs: - targets: - redis://172.22.1.4:6380 - redis://172.22.1.4:6381 params: check-keys: ["metrics:*"] metrics_path: /scrape relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 172.22.15.84:9121 #监控redis - job_name: 'redis_exporter' static_configs: - targets: - 172.22.15.84:9121
ps:replacement:redis_exporter所在机器的ip+端口
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。