Update install-dsmon.sh

This commit is contained in:
2025-06-01 20:07:39 -05:00
parent 0d61de9938
commit 4f3497913a

View File

@@ -29,10 +29,18 @@ fi
if [[ "${RNIP}" == "10.6.1"* ]]; then
mysqlcmd="mysql"
mysqlip=10.6.1.5
do_with_root $APTFUNC install wget curl git mailutils bc mysql-client-8.0
else
mysqlcmd="mariadb --skip-ssl"
do_with_root $APTFUNC install wget curl git mailutils bc mariadb-client
if [ "$(CHECK_HOST 10.10.1.50)" != "false" ]; then
mysqlip=10.10.1.50
elif [ "$(CHECK_HOST 100.100.2.2)" != "false" ]; then
mysqlip=100.100.2.2
else
mysqlip=
fi
fi
@@ -152,16 +160,6 @@ if [ "${SET_SERVERMONID}" = "new" ]; then
thresholdlog+=("${KEY}:${THRESHOLD[$KEY]}")
done
if [ "$(CHECK_HOST 10.10.1.50)" != "false" ]; then
mysqlip=10.10.1.50
elif [ "$(CHECK_HOST 100.100.2.2)" != "false" ]; then
mysqlip=100.100.2.2
elif [ "$(CHECK_HOST 10.6.1.5)" != "false" ]; then
mysqlip=10.6.1.5
else
mysqlip=
fi
if [ "${mysqlip}" != "" ]; then
QRY="USE servermonitor; INSERT INTO hosts (\`host\`,\`hostname\`,\`ip\`,\`limits\`) VALUES ('${ADD_SERVERNAME}','${ADD_SERVERHOSTNAME}','${SERVERIPS// /}','${thresholdlog[@]}');"
${mysqlcmd} -h ${mysqlip} -u sysmoninsert -psysmoninsert -e "${QRY}"