From 4c5a8c314fd77c14e1d1d314bd054f94c537dc7d Mon Sep 17 00:00:00 2001 From: xiaoz Date: Tue, 4 Jan 2022 18:57:35 +0800 Subject: [PATCH] update --- node_exporter.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/node_exporter.sh b/node_exporter.sh index f9ae607..72f359f 100644 --- a/node_exporter.sh +++ b/node_exporter.sh @@ -6,9 +6,9 @@ #获取版本号 VERSION=$1 #instance名称 -INSTANCE=$2 +#INSTANCE=$2 #用户名、密码 -USERNAME_PASSWORD=$3 +#USERNAME_PASSWORD=$3 #安装目录 INSTALL_PATH="/opt/node_exporter" @@ -23,8 +23,11 @@ depend(){ apt-get -y update apt-get install -y wget curl fi - #创建目录 - #mkdir -p ${INSTALL_PATH} + #获取INSTANCE名称,如果为空,则获取hostname + if [[ "$INSTANCE" == "" ]] + then + INSTANCE=$(echo $HOSTNAME) + fi } #下载 download(){ @@ -89,7 +92,7 @@ WantedBy=default.target" > /etc/systemd/system/node_exporter.service #安装完成 install_success(){ - myip=$(curl -s ip.sb) + echo "Installation is complete, please visit http://${myip}:29100" }