当前位置: 首页 > news >正文

prometheus之redis_exporter部署

下载解压压缩包

mkdir /opt/redis_exporter/
cd /opt/redis_exporter/
wget http://soft.download/soft/linux/prometheus/redis_exporter/redis_exporter-v1.50.0.linux-amd64.tar.gz
tar -zxvf redis_exporter-v1.50.0.linux-amd64.tar.gz
ln -s /opt/redis_exporter/redis_exporter-v1.50.0.linux-amd64/redis_exporter /usr/bin/

服务文件

vim /etc/systemd/system/redis_exporter.service
[Service]
ExecStart=/usr/bin/redis_exporter -web.listen-address :9121 -redis.addr redis://127.0.0.1:6379 -redis.password qwer552434
[Install]
WantedBy=multi-user.target
[Unit]
Description=redis_exporter
After=network.target

设置开机自启并启动服务

systemctl  daemon-reload
systemctl enable redis_exporter
systemctl start redis_exporter
systemctl status redis_exporter

防火墙放行端口

firewall-cmd --permanent --add-port=9121/tcp --zone=public&&firewall-cmd --reload

安装脚本

cat install_redis_exporter.sh
#!/bin/bash
InstallDir='/opt/redis_exporter/'
FileName='redis_exporter-v1.50.0.linux-amd64.tar.gz'function RedFont(){echo -e "\033[31mError: $1 \033[0m"
}function GreenFont(){echo -e "\033[32mSuccess: $1 \033[0m"
}function YellowFont(){echo -e "\033[33mWarning: $1 \033[0m"
}if [ ! -d "$InstallDir" ];thenmkdir $InstallDir
elseYellowFont "${InstallDir}文件夹已经存在,请删除后重新执行"exit
fi#进入安装目录
cd $InstallDir#下载安装包
wget http://soft.download/soft/linux/prometheus/redis_exporter/$FileName > /dev/null 2>&1if [ $? -eq 0 ];thenGreenFont "$FileName download success"
elseRedFont "$FileName download faild"exit
fi#解压安装包到指定目录,解压不包含压缩一级目录
tar -zxf $FileName --strip-components 1 -C $InstallDir > /dev/null 2>&1if [ $? -eq 0 ];thenGreenFont "$FileName decompress success"
elseRedFont "$FileName decompress faild"exit
fi#设置开机自启
cat > /etc/systemd/system/redis_exporter.service << EOF
[Service]
ExecStart=${InstallDir}redis_exporter -web.listen-address :9121 -redis.addr redis://127.0.0.1:6379 -redis.password qwer552434
[Install]
WantedBy=multi-user.target
[Unit]
Description=redis_exporter
After=network.target
EOF#防火墙放行端口
firewall-cmd --permanent --add-port=9121/tcp --zone=public&&firewall-cmd --reload#启动服务
systemctl  daemon-reload
systemctl enable redis_exporter
systemctl start redis_exporter && GreenFont "started redis_exporter" || RedFont "start redis_exporter faild"
http://www.lryc.cn/news/299125.html

相关文章:

  • js 解构赋值
  • Vivado用ILA抓波形保存为CSV文件
  • 微软AD域替代方案,助力企业摆脱hw期间被攻击的窘境
  • Git教程I
  • containerd中文翻译系列(十)镜像验证
  • 假期day9(2024/2/14)
  • Leetcode 674 最长连续递增序列
  • 力扣题目训练(8)
  • 理解JAVA EE设计模式
  • GEE:梯度提升树(Gradient Boosting Tree)回归教程(样本点、特征添加、训练、精度、参数优化)
  • k8s-资源限制与监控 15
  • 【Ubuntu】在.bashrc文件中误设置环境变量补救方法
  • Imgui(1) | 基于imgui-SFML改进自由落体小球
  • Linux-Vim的使用,快速入门Vim,Linux入门教程,精讲Linux
  • 目标检测 | 卷积神经网络(CNN)详细介绍及其原理详解
  • 机器人学、机器视觉与控制 上机笔记(第一版译文版 2.1章节)
  • 关于vue2+antd 信息发布后台不足的地方
  • Ubuntu+Anaconda 常用指令记录
  • P5732 【深基5.习7】杨辉三角 python解法
  • VitePress-12-markdown中使用vue的语法
  • “bound drug/molecule”or “unbound drug/molecule”、molecule shape、sketching是什么?
  • 深入理解C语言中的函数指针:概念、机制及实战应用
  • 《UE5_C++多人TPS完整教程》学习笔记1 ——《P2 关于本课程(About This Course)》
  • 权限系统设计
  • Ubuntu Desktop - Screenshot (截图工具)
  • docker 1:介绍
  • RibbonBar RibbonPage切换事件
  • Conda历史版本下载地址和python对应关系
  • Clickhouse查询语句执行过程
  • 【动态规划】【中位数】【C++算法】1478. 安排邮筒