Update nodemgmt-scripts.sh

This commit is contained in:
2019-12-12 23:19:01 -06:00
parent bdee389b54
commit 4144ef962e

View File

@@ -250,6 +250,8 @@ STATUS(){
fi
########################
## REPLICATION CHECK
########################
if [ "${ST_ACTION}" = "" ] || [ "${ST_ACTION}" = "report" ] || [ "${ST_ACTION}" = "repl" ]; then
if [ "${ST_ACTION}" != "check" ]; then
echo -e "${idsST[Bold]}"; DIVIDER
@@ -355,6 +357,51 @@ STATUS(){
fi
done
fi
########################
## FREE SPACE CHECK
########################
if [ "${ST_ACTION}" = "" ] || [ "${ST_ACTION}" = "report" ]; then
if [ "${ST_ACTION}" != "repl" ] && [ "${ST_ACTION}" != "services" ]; then
if [ "${ST_ACTION}" != "check" ]; then
echo -e "${idsST[Bold]}"; DIVIDER
echo -e "${idsCL[Yellow]} ${NM_NODETYPES[$NTYPE]}-Node Free Space Scan${idsCL[Default]}"
DIVIDER; echo -e "${idsST[Reset]}"
fi
for NTYPE in "${NODE_TYPES[@]}"; do
nid=1
var=${NTYPE}_HOSTS[@]
for nip in "${!var}"; do
if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then NCMD=''; LH='- localhost'
else NCMD="ssh root@${nip}"; LH=''
fi
if [ "${NCMD}" != "" ]; then
checkhost=$(CHECK_HOST ${nip})
fi
if [ "${ST_ACTION}" != "check" ]; then
echo -e " ${idsST[Bold]}${idsCL[LightCyan]}${NM_NODETYPES[$NTYPE]}-Node${nid} (${nip})${idsST[Reset]}${idsCL[LightCyan]} ${idsCL[LightYello]}${LH}${idsCL[Default]}"
DIVIDER false green
fi
df -hBM | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output; do
freespace=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ "${ST_ACTION}" != "check" ]; then
c=0; cw=22; spc=''
spc1=${cw}-${#partition}
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
echo -en " ${partition}$spc: "
echo -e "${idsCL[Green]}${freespace}${idsCL[Default]}"
fi
done
nid=`expr $nid + 1`
done
done
fi
fi
########################
########################
if [ "${ST_ACTION}" != "check" ]; then
echo ""