Update install-dsmon.sh
This commit is contained in:
@@ -28,10 +28,10 @@ fi
|
|||||||
RNIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
RNIP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
|
||||||
|
|
||||||
if [[ "${RNIP}" == "10.6.1"* ]]; then
|
if [[ "${RNIP}" == "10.6.1"* ]]; then
|
||||||
mysqlcmd=mysql
|
mysqlcmd="mysql"
|
||||||
do_with_root $APTFUNC install wget curl git mailutils bc mysql-client-8.0
|
do_with_root $APTFUNC install wget curl git mailutils bc mysql-client-8.0
|
||||||
else
|
else
|
||||||
mysqlcmd=mariadb
|
mysqlcmd="mariadb --skip-ssl"
|
||||||
do_with_root $APTFUNC install wget curl git mailutils bc mariadb-client
|
do_with_root $APTFUNC install wget curl git mailutils bc mariadb-client
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -164,9 +164,9 @@ if [ "${SET_SERVERMONID}" = "new" ]; then
|
|||||||
|
|
||||||
if [ "${mysqlip}" != "" ]; then
|
if [ "${mysqlip}" != "" ]; then
|
||||||
QRY="USE servermonitor; INSERT INTO hosts (\`host\`,\`hostname\`,\`ip\`,\`limits\`) VALUES ('${ADD_SERVERNAME}','${ADD_SERVERHOSTNAME}','${SERVERIPS// /}','${thresholdlog[@]}');"
|
QRY="USE servermonitor; INSERT INTO hosts (\`host\`,\`hostname\`,\`ip\`,\`limits\`) VALUES ('${ADD_SERVERNAME}','${ADD_SERVERHOSTNAME}','${SERVERIPS// /}','${thresholdlog[@]}');"
|
||||||
${mysqlcmd} --skip-ssl -h ${mysqlip} -u sysmoninsert -psysmoninsert -e "${QRY}"
|
${mysqlcmd} -h ${mysqlip} -u sysmoninsert -psysmoninsert -e "${QRY}"
|
||||||
QRY="USE servermonitor; SELECT id FROM hosts WHERE host='${ADD_SERVERNAME}';"
|
QRY="USE servermonitor; SELECT id FROM hosts WHERE host='${ADD_SERVERNAME}';"
|
||||||
SET_SERVERMONID=`${mysqlcmd} --skip-ssl -h ${mysqlip} -u sysmoninsert -psysmoninsert -e "${QRY}"`
|
SET_SERVERMONID=`${mysqlcmd} -h ${mysqlip} -u sysmoninsert -psysmoninsert -e "${QRY}"`
|
||||||
else
|
else
|
||||||
echo -e "${idsCL[Red]}Could not connect to MySQL${idsCL[Default]}"
|
echo -e "${idsCL[Red]}Could not connect to MySQL${idsCL[Default]}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user