Browse Source

一些优化

master
xiaoz 3 years ago
parent
commit
b370130b15
  1. 15
      node_exporter.sh

15
node_exporter.sh

@ -51,8 +51,12 @@ release_port(){
which firewall-cmd which firewall-cmd
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
firewall-cmd --zone=public --add-port=29100/tcp --permanent firewall_status=$(firewall-cmd --state)
firewall-cmd --reload if[[ "firewall_status" == "running" ]]
then
firewall-cmd --zone=public --add-port=29100/tcp --permanent
firewall-cmd --reload
fi
fi fi
which ufw which ufw
if [ $? -eq 0 ] if [ $? -eq 0 ]
@ -79,11 +83,13 @@ WantedBy=default.target" > /etc/systemd/system/node_exporter.service
systemctl daemon-reload systemctl daemon-reload
#启动服务 #启动服务
systemctl start node_exporter.service systemctl start node_exporter.service
#设置开机自启
systemctl enable node_exporter.service
} }
#安装完成 #安装完成
install_success(){ install_success(){
myip=$(curl ip.sb) myip=$(curl -s ip.sb)
echo "Installation is complete, please visit http://${myip}:29100" echo "Installation is complete, please visit http://${myip}:29100"
} }
@ -93,5 +99,4 @@ clean_work() {
rm -rf /opt/node_exporter-${VERSION}.linux-amd64.tar.gz rm -rf /opt/node_exporter-${VERSION}.linux-amd64.tar.gz
} }
depend && download && setting && release_port && reg_systemd && install_success depend && download && setting && release_port && reg_systemd && clean_work && install_success
clean_work

Loading…
Cancel
Save