cat /etc/redis.conf | grep -v '#' | grep requirepass
# 下载
cd /tmp
wget https://github.com/oliver006/redis_exporter/releases/download/v1.0.3/redis_exporter-v1.0.3.linux-amd64.tar.gz
tar xvf redis_exporter-v1.0.3.linux-amd64.tar.gz -C /ops
# 编写systemd service文件
vi /usr/lib/systemd/system/redis_exporter.service
[Unit]
Description=Redis exporter
[Service]
Type=simple
ExecStart=/ops/redis_exporter-v1.0.3.linux-amd64/redis_exporter --redis.password=密码
[Install]
WantedBy=mutil-user.target
# 启动与自启动
systemctl daemon-reload
systemctl start redis_exporter
systemctl enable redis_exporter
firewall-cmd --add-port=9121/tcp --permanent
firewall-cmd --reload
vi prometheus.yaml
scrapy_confings:
···
- job_name: Redis
static_configs:
- targets:
- ip:9121
labels:
instance: Redis
# 如果你已注册了prometheus服务
systemctl restart prometheus
# 如果你是使用supervisor管理prometheus的话
supervisorctl restart prometheus