#!/bin/bash



#echo 安装普罗米修斯客户端
echo 安装普罗米修斯客户端
curl -O http://8.134.164.78:1778/node_exporter-1.3.1.linux-amd64.tar.gz


tar -zxvf node_exporter-1.3.1.linux-amd64.tar.gz -C /usr/local/


mv /usr/local/node_exporter-1.3.1.linux-amd64   /usr/local/node_exporter
# 进入解压出的目录
cd /usr/local/node_exporter
# 运行监控采集服务
# nohup ./node_exporter &


# 创建并编辑node_exporter.service服务文件
echo  创建并编辑node_exporter.service服务文件
cat << EOF | sudo tee /usr/lib/systemd/system/node_exporter.service
[Unit]
Description=node_exporter Monitoring System
Documentation=node_exporter Monitoring System

[Service]
ExecStart=/usr/local/node_exporter/node_exporter --web.listen-address=:9100

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl start node_exporter.service
systemctl status node_exporter.service
systemctl enable node_exporter.service





firewall-cmd --add-port=9100/tcp --permanent

 firewall-cmd --reload


echo 普罗米修斯客户端-安装完成
