Update install-dsmon.sh
This commit is contained in:
@@ -90,41 +90,6 @@ echo -e -n "${idsCL[LightCyan]}Server Monitor ID (optional, or type 'new'): ${id
|
|||||||
read SET_SERVERMONID
|
read SET_SERVERMONID
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ "${SET_SERVERMONID}" = "new" ]; then
|
|
||||||
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
|
|
||||||
|
|
||||||
ADD_SERVERHOSTNAME=(`hostname`)
|
|
||||||
ADD_SERVERIP=(`hostname -I`)
|
|
||||||
ADD_SERVERIPS=''
|
|
||||||
for nip in "${ADD_SERVERIP[@]}"; do
|
|
||||||
if [[ "${nip}" == *"."* ]]; then
|
|
||||||
if [ "${ADD_SERVERIPS}" = "" ]; then
|
|
||||||
SERVERIPS=${nip}
|
|
||||||
else
|
|
||||||
SERVERIPS=${ADD_SERVERIPS}";"${nip}
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
QRY="USE servermonitor; INSERT INTO hosts (\`host\`,\`hostname\`,\`ip\`) VALUES ('${ADD_SERVERNAME}','${ADD_SERVERHOSTNAME}','${SERVERIPS// /}');"
|
|
||||||
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}"`
|
|
||||||
|
|
||||||
echo -en "${idsCL[LightGreen]}Server successfully added, it was given ID# "
|
|
||||||
echo -e ${SET_SERVERMONID//id
|
|
||||||
}${idsCL[Default]}
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
echo -e "${idsCL[Yellow]}Sending test Alert... ${idsCL[Default]}"
|
echo -e "${idsCL[Yellow]}Sending test Alert... ${idsCL[Default]}"
|
||||||
echo "Test Alert" | mail -r DSMon_$(hostname -s)@scity.us -s "Test" $SET_ALERTEMAIL
|
echo "Test Alert" | mail -r DSMon_$(hostname -s)@scity.us -s "Test" $SET_ALERTEMAIL
|
||||||
@@ -150,6 +115,51 @@ echo \"** Low Disk Space Alert Sent **\" >> /opt/idssys/dsmon/diskspace.log
|
|||||||
|
|
||||||
" > /opt/idssys/dsmon/config.actions.inc
|
" > /opt/idssys/dsmon/config.actions.inc
|
||||||
|
|
||||||
|
|
||||||
|
if [ "${SET_SERVERMONID}" = "new" ]; then
|
||||||
|
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
|
||||||
|
|
||||||
|
source /opt/idssys/dsmon/config.settings.inc
|
||||||
|
|
||||||
|
ADD_SERVERHOSTNAME=(`hostname`)
|
||||||
|
ADD_SERVERIP=(`hostname -I`)
|
||||||
|
ADD_SERVERIPS=''
|
||||||
|
for nip in "${ADD_SERVERIP[@]}"; do
|
||||||
|
if [[ "${nip}" == *"."* ]]; then
|
||||||
|
if [ "${ADD_SERVERIPS}" = "" ]; then
|
||||||
|
SERVERIPS=${nip}
|
||||||
|
else
|
||||||
|
SERVERIPS=${ADD_SERVERIPS}";"${nip}
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
thresholdlog=()
|
||||||
|
for KEY in "${!THRESHOLD[@]}"; do
|
||||||
|
thresholdlog+=("${KEY}:${THRESHOLD[$KEY]}")
|
||||||
|
done
|
||||||
|
|
||||||
|
QRY="USE servermonitor; INSERT INTO hosts (\`host\`,\`hostname\`,\`ip\`) VALUES ('${ADD_SERVERNAME}','${ADD_SERVERHOSTNAME}','${SERVERIPS// /}');"
|
||||||
|
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}"`
|
||||||
|
|
||||||
|
echo -en "${idsCL[LightGreen]}Server successfully added, it was given ID# "
|
||||||
|
echo -e ${SET_SERVERMONID//id
|
||||||
|
}${idsCL[Default]}
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/usr/local/bin/dsmon hdd
|
/usr/local/bin/dsmon hdd
|
||||||
/usr/local/bin/dsmon sys
|
/usr/local/bin/dsmon sys
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user