Prometheus 采集redis监控数据

Posted CIAS

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Prometheus 采集redis监控数据相关的知识,希望对你有一定的参考价值。

download  redis_exporter

 redis_exporter 一键监控安装脚本

  • ExecStart=/opt/redis_exporter/redis_exporter -log.level=debug -log-format='txt' -redis.addr=192.168.11.253:6379 -redis.password=YOU_password #更改主机redis 主机IP用户名密码
  • 采集端口9121
vim /redis_exporter.sh
#!/bin/sh
# -*- coding: utf-8 -*-
# Date: 2022/11/18


echo "download redis_exporter"
sleep 2
wget -N -P /opt/ https://github.com/oliver006/redis_exporter/releases/download/v1.24.0/redis_exporter-v1.24.0.linux-amd64.tar.gz

echo "decompression redis_exporter"
sleep 2
tar -xf /opt/redis_exporter-v1.24.0.linux-amd64.tar.gz /opt/.tar.gz -C /opt/


echo "rechristen redis_exporter"
sleep 2
mv /opt/redis_exporter-v1.24.0.linux-amd64 /opt/redis_exporter

echo "add redis_exporter.service"
sleep 2
cat << EOF > /etc/systemd/system/redis_exporter.service
[Unit]
Description=redis_exporter
Documentation=https://github.com/prometheus/redis_exporter
After=local-fs.target network-online.target network.target
Wants=local-fs.target network-online.target network.target
 
[Service]
User=root
Group=root
Type=simple
ExecStart=/opt/redis_exporter/redis_exporter -log.level=debug -log-format='txt' -redis.addr=192.168.11.253:6379 -redis.password=YOU_password

Restart=on-failure

[Install]
WantedBy=multi-user.target
EOF

echo "start redis_exporter"
sleep 2
systemctl daemon-reload && systemctl enable --now redis_exporter

echo "firewall redis_exporter"
sleep 2
firewall-cmd --zone=public --add-port=9121/tcp --permanent && firewall-cmd --zone=public --add-port=6379/tcp --permanent  && firewall-cmd --reload

执行安装

sh /redis_exporter.sh

以上是关于Prometheus 采集redis监控数据的主要内容,如果未能解决你的问题,请参考以下文章

Prometheus 采集rabbitmq监控数据

Prometheus 采集rabbitmq监控数据

Prometheus 采集snmp监控数据

Prometheus 采集Mysql监控数据

Prometheus 采集rabbitmq监控数据

Prometheus 采集Windows主机监控数据