Update nodemgmt-scripts.sh
This commit is contained in:
@@ -86,7 +86,7 @@ STATUS() {
|
|||||||
nid=`expr $nid + 1`
|
nid=`expr $nid + 1`
|
||||||
done
|
done
|
||||||
echo -e "${idsST[Bold]}"; DIVIDER
|
echo -e "${idsST[Bold]}"; DIVIDER
|
||||||
echo -e "${idsCL[Yellow]} Replication Status to Other Nodes${idsCL[Default]}"
|
echo -e "${idsCL[Yellow]} Replication Status Between the Primary and Secondary Nodes${idsCL[Default]}"
|
||||||
DIVIDER; echo -e "${idsST[Reset]}"
|
DIVIDER; echo -e "${idsST[Reset]}"
|
||||||
timeout=`date --date='30 seconds' +%s`
|
timeout=`date --date='30 seconds' +%s`
|
||||||
nid=1
|
nid=1
|
||||||
@@ -110,16 +110,13 @@ STATUS() {
|
|||||||
checked="`ssh root@10.5.10.51 \"ssh root@${nip} \"cat ${REPL_CHECKS[${rcheck}]}/test.repl\" | diff - ${REPL_CHECKS[${rcheck}]}/test.repl\"`"
|
checked="`ssh root@10.5.10.51 \"ssh root@${nip} \"cat ${REPL_CHECKS[${rcheck}]}/test.repl\" | diff - ${REPL_CHECKS[${rcheck}]}/test.repl\"`"
|
||||||
fi
|
fi
|
||||||
if [ "`date +%s`" -gt "$timeout" ]; then
|
if [ "`date +%s`" -gt "$timeout" ]; then
|
||||||
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then
|
|
||||||
echo "Timeout occurred in waiting for replication between nodes." | mail -s "Status-Check" ${STATUS_CHECK_EMAIL}
|
|
||||||
fi
|
|
||||||
timeout=true
|
timeout=true
|
||||||
touch ${FOLDER}/${nip}-${rcheck}.down
|
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ "${timeout}" = "true" ]; then
|
if [ "${timeout}" = "true" ]; then
|
||||||
echo -e "${idsCL[Red]}Timeout${idsCL[Default]}"
|
echo -e "${idsCL[Red]}Timeout${idsCL[Default]}"
|
||||||
|
touch ${FOLDER}/${nip}-${rcheck}.down
|
||||||
else
|
else
|
||||||
echo -e "${idsCL[Green]}Good${idsCL[Default]}"
|
echo -e "${idsCL[Green]}Good${idsCL[Default]}"
|
||||||
rm -f ${FOLDER}/${nip}-${rcheck}.down
|
rm -f ${FOLDER}/${nip}-${rcheck}.down
|
||||||
@@ -141,14 +138,15 @@ STATUS-CHECK(){
|
|||||||
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then
|
if [ "${STATUS_CHECK_EMAIL}" != "" ]; then
|
||||||
if [ ! -z ${LOCAL_SERVICES+x} ]; then NCMD='ssh root@10.5.10.51'
|
if [ ! -z ${LOCAL_SERVICES+x} ]; then NCMD='ssh root@10.5.10.51'
|
||||||
else NCMD=''; fi
|
else NCMD=''; fi
|
||||||
for nip in "${NODE_HOSTS[@]}"; do
|
for rcheck in "${REPL_CHECK[@]}"; do
|
||||||
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
|
${NCMD} rm -f ${FOLDER}/test.repl
|
||||||
for rcheck in "${REPL_CHECK[@]}"; do
|
daterun=`date +%Y-%m-%d-%H-%M-%S`
|
||||||
${NCMD} rm -f ${FOLDER}/test.repl
|
if [ "${NCMD}" = "" ]; then
|
||||||
daterun=`date +%Y-%m-%d-%H-%M-%S`
|
echo -e "iDS-Node${nid} (${nip})\n${daterun}" > ${FOLDER}/test.repl
|
||||||
${NCMD} echo -e "iDS-Node${nid} (${nip})\n${daterun}" > ${FOLDER}/test.repl
|
yes | cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl
|
||||||
${NCMD} yes | cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl
|
else
|
||||||
done
|
${NCMD} "echo -e \"Status-Check (${NODE_HOSTNAME})\n${daterun}\" > ${FOLDER}/test.repl"
|
||||||
|
yes | ${NCMD} "cp -rfH ${FOLDER}/test.repl ${REPL_CHECKS[${rcheck}]}/test.repl"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
if [ ! -z ${LOCAL_SERVICES+x} ]; then
|
if [ ! -z ${LOCAL_SERVICES+x} ]; then
|
||||||
@@ -186,22 +184,35 @@ STATUS-CHECK(){
|
|||||||
fi
|
fi
|
||||||
#REPLICATION CHECK
|
#REPLICATION CHECK
|
||||||
timeout=`date --date='30 seconds' +%s`
|
timeout=`date --date='30 seconds' +%s`
|
||||||
|
nid=1
|
||||||
for nip in "${NODE_HOSTS[@]}"
|
for nip in "${NODE_HOSTS[@]}"
|
||||||
do
|
do
|
||||||
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]]; then
|
if [ "${nip}" = '10.5.10.51' ] && [ ! -z ${LOCAL_SERVICES+x} ]; then isreplhost=true; else isreplhost=false; fi
|
||||||
|
if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) != *"${nip}"* ]] && [ "${isreplhost}" = "false" ]; then
|
||||||
for rcheck in "${REPL_CHECK[@]}"
|
for rcheck in "${REPL_CHECK[@]}"
|
||||||
do
|
do
|
||||||
checked=false
|
checked=false
|
||||||
until [ "${checked}" = "" ]; do
|
until [ "${checked}" = "" ]; do
|
||||||
checked=`ssh root@${nip} "cat ${REPL_CHECKS[${rcheck}]}/test.repl" | diff - ${REPL_CHECKS[${rcheck}]}/test.repl`
|
if [ "${NCMD}" = "" ]; then
|
||||||
|
checked=`ssh root@${nip} "cat ${REPL_CHECKS[${rcheck}]}/test.repl" | diff - ${REPL_CHECKS[${rcheck}]}/test.repl`
|
||||||
|
else
|
||||||
|
checked="`ssh root@10.5.10.51 \"ssh root@${nip} \"cat ${REPL_CHECKS[${rcheck}]}/test.repl\" | diff - ${REPL_CHECKS[${rcheck}]}/test.repl\"`"
|
||||||
|
fi
|
||||||
if [ "`date +%s`" -gt "$timeout" ]; then
|
if [ "`date +%s`" -gt "$timeout" ]; then
|
||||||
echo "Timeout occurred in waiting for replication between nodes." | mail -s "Status-Check" ${STATUS_CHECK_EMAIL}
|
|
||||||
timeout=true
|
timeout=true
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ "${timeout}" = "true" ]; then
|
||||||
|
touch ${FOLDER}/${nip}-${rcheck}.down
|
||||||
|
echo "Timeout occurred in waiting for replication between primary node and iDS-Node${nid} (${nip})." | mail -s "Status-Check" ${STATUS_CHECK_EMAIL}
|
||||||
|
else
|
||||||
|
rm -f ${FOLDER}/${nip}-${rcheck}.down
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
echo
|
||||||
fi
|
fi
|
||||||
|
nid=`expr $nid + 1`
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user