diff --git a/install-dsmon.sh b/install-dsmon.sh index 05fd3c2..ed6c1cd 100755 --- a/install-dsmon.sh +++ b/install-dsmon.sh @@ -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 ""