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