Update install-dsmon.sh

This commit is contained in:
2022-03-10 22:14:03 -06:00
parent e4b7cec6b5
commit 2c0fbdff6d

View File

@@ -43,13 +43,22 @@ read SET_SERVERMONID
echo ""
if [ "${SET_SERVERMONID}" = "new" ]; then
echo -e -n "${idsCL[LightCyan]}Server Name: ${idsCL[Default]}"
hostname=`hostname`
echo -e -n "${idsCL[LightCyan]}Server Name (Default=${hostname}): ${idsCL[Default]}"
read ADD_SERVERNAME
echo ""
if [ "${ADD_SERVERNAME}" = "" ]; then
ADD_SERVERNAME=${hostname}
fi
QRY="USE servermonitor; INSERT INTO hosts (\`host\`) VALUES ('${ADD_SERVERNAME}');"
mysql -h mysqldb.scity.us -P 6033 --user=sysmoninsert --password=sysmoninsert -e "${QRY}"
QRY="USE servermonitor; SELECT id FROM hosts WHERE host='${ADD_SERVERNAME}';"
SET_SERVERMONID=`mysql -h mysqldb.scity.us -P 6033 --user=sysmoninsert --password=sysmoninsert -e "${QRY}"`
SET_SERVERMONID=${SET_SERVERMONID//id
/}
echo -e "${idsCL[LightGreen]}Server successfully added, it was given ID# ${SET_SERVERMONID}${idsCL[Default]}"
echo ""