Update nodemgmt-scripts.sh

This commit is contained in:
2023-01-01 08:42:01 -06:00
parent d80a35a246
commit 9144658ce4

View File

@@ -2302,44 +2302,48 @@ DOWNLIST(){
fi fi
echo echo
echo -e "${idsCL[LightGreen]}Current List of Items Down...${idsCL[Default]}" if [ "${DOWNLIST}" == "" ]; then
DIVIDER false yellow echo -e "${idsCL[LightCyan]}Nothing is down${idsCL[Default]}"
echo -e "Service/Host Host Down_Time" else
DIVIDER false yellow echo -e "${idsCL[LightGreen]}Current List of Items Down...${idsCL[Default]}"
DIVIDER false yellow
echo -e "Service/Host Host Down_Time"
DIVIDER false yellow
cw=40; cw2=58 cw=40; cw2=58
for downitem in ${DOWN_LIST}; do for downitem in ${DOWN_LIST}; do
ditem=${downitem##*/} ditem=${downitem##*/}
ditem=${ditem//.down} ditem=${ditem//.down}
host=${ditem%%-*} host=${ditem%%-*}
item=${ditem#*-} item=${ditem#*-}
if [[ $ditem == *"-"* ]] && [ "${NM_SERVICES[${item}]}" != "" ]; then if [[ $ditem == *"-"* ]] && [ "${NM_SERVICES[${item}]}" != "" ]; then
itemname=${NM_SERVICES[${ditem#*-}]} itemname=${NM_SERVICES[${ditem#*-}]}
elif [[ $ditem == *"-"* ]] && [ "${NM_DOCKERS[${item}]}" != "" ]; then elif [[ $ditem == *"-"* ]] && [ "${NM_DOCKERS[${item}]}" != "" ]; then
itemname="${NM_DOCKERS[${ditem#*-}]} (docker)" itemname="${NM_DOCKERS[${ditem#*-}]} (docker)"
elif [[ $ditem == *"-"* ]] && [ "${REPL_DESC[${item}]}" != "" ]; then elif [[ $ditem == *"-"* ]] && [ "${REPL_DESC[${item}]}" != "" ]; then
itemname="${REPL_DESC[${item}]} (replication)" itemname="${REPL_DESC[${item}]} (replication)"
else else
itemname='HOST DOWN'; itemname='HOST DOWN';
fi fi
if [ -f ${FOLDER}/${ditem}.errtime ]; then if [ -f ${FOLDER}/${ditem}.errtime ]; then
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${ditem}.errtime) toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${ditem}.errtime)
else else
toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${ditem}.down) toterrtime=`date +%s`-$(stat -c %Y ${FOLDER}/${ditem}.down)
fi fi
c=0; spc='' c=0; spc=''
spc1=${cw}-${#itemname} spc1=${cw}-${#itemname}
#echo "HERE: $downitem ~ $ditem ~ $host ~ $item ~ $itemname ~ $spc1" #echo "HERE: $downitem ~ $ditem ~ $host ~ $item ~ $itemname ~ $spc1"
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
c=0; spc2='' c=0; spc2=''
spc1=${cw2}-${#itemname}-${#host}-${spc1} spc1=${cw2}-${#itemname}-${#host}-${spc1}
until [ $c = ${spc1} ]; do spc2="${spc2} "; c=`expr $c + 1`; done until [ $c = ${spc1} ]; do spc2="${spc2} "; c=`expr $c + 1`; done
echo -e "${idsST[Bold]}${idsCL[Red]}${itemname}${spc}${host}${spc2}$(SHOW_TIME ${toterrtime})${idsST[Reset]}${idsCL[Default]}" echo -e "${idsST[Bold]}${idsCL[Red]}${itemname}${spc}${host}${spc2}$(SHOW_TIME ${toterrtime})${idsST[Reset]}${idsCL[Default]}"
DIVIDER false darkGray DIVIDER false darkGray
done done
fi
echo echo
if [ -z $action ] || [ "${action}" = "gui" ]; then if [ -z $action ] || [ "${action}" = "gui" ]; then
DIVIDER true DIVIDER true