Browse Source

一些优化

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

11
node_exporter.sh

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

Loading…
Cancel
Save