Update nodemgmt-scripts.sh

This commit is contained in:
2023-11-08 21:46:50 -06:00
parent 708d140f15
commit 6b3c4f19e2

View File

@@ -721,58 +721,64 @@ DOWNLIST(){
echo -e "${idsCL[Yellow]} Service/Host Host Down_Time Notifications${idsCL[Default]}"
fi
DIVIDER false yellow 95
cw=50; cw2=65; is=1;
for downitem in ${DOWN_LIST}; do
ditem=${downitem##*/}
ditem=${ditem//.down}
host=${ditem%%~*}
item=${ditem#*~}
until [ "${choice^^}" = "D" ]; do
cw=50; cw2=65; is=1;
for downitem in ${DOWN_LIST}; do
ditem=${downitem##*/}
ditem=${ditem//.down}
host=${ditem%%~*}
item=${ditem#*~}
if [ "${1}" == "ignore" ]; then
[ ${is} -lt 10 ] && ignsel=" ${is}) " || ignsel="${is}) "
else
ignsel=""
fi
if [[ $ditem == *"~"* ]] && [ "${NM_SERVICE_DESC[${item}]}" != "" ]; then
itemname=${NM_SERVICE_DESC[${item}]}
elif [[ $ditem == *"~"* ]] && [ "${NM_DOCKER_DESC[${item}]}" != "" ]; then
itemname="${NM_DOCKER_DESC[${item}]} (docker)"
elif [[ $ditem == *"~"* ]] && [ "${NM_REPL_DESC[${item}]}" != "" ]; then
itemname="${NM_REPL_DESC[${item}]} (replication)"
else
itemname="${item} DOWN";
[ "${NM_HOSTNAMES[${host}]}" != "" ] && itemname="${itemname}: ${NM_HOSTNAMES[${host}]}"
fi
if [ -f ${NM_TMPFOLDER}/${ditem}.errtime ]; then
toterrtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${ditem}.errtime)
else
toterrtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${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 "${idsCL[LightRed]}${idsST[Bold]}${ignsel}${idsST[Reset]}${idsCL[LightRed]}${itemname}${spc}${host}${spc2}$(SHOW_TIME ${toterrtime})${idsCL[Default]}"
DIVIDER false darkGray 90
((is++))
done
echo
if [ "${1}" == "ignore" ]; then
[ ${is} -lt 10 ] && ignsel=" ${is}) " || ignsel="${is}) "
IFS=$'\n'
read -rd '' -a DOWNLIST <<<"${DOWN_LIST}"
unset IFS
echo -en "${idsCL[LightCyan]}Enter # to change notifications: ${idsCL[Default]}"
read -n 1 choice
echo "HERE: ${DOWNLIST[$(expr ${choice}-1)]}"
else
ignsel=""
choice=D
fi
if [[ $ditem == *"~"* ]] && [ "${NM_SERVICE_DESC[${item}]}" != "" ]; then
itemname=${NM_SERVICE_DESC[${item}]}
elif [[ $ditem == *"~"* ]] && [ "${NM_DOCKER_DESC[${item}]}" != "" ]; then
itemname="${NM_DOCKER_DESC[${item}]} (docker)"
elif [[ $ditem == *"~"* ]] && [ "${NM_REPL_DESC[${item}]}" != "" ]; then
itemname="${NM_REPL_DESC[${item}]} (replication)"
else
itemname="${item} DOWN";
[ "${NM_HOSTNAMES[${host}]}" != "" ] && itemname="${itemname}: ${NM_HOSTNAMES[${host}]}"
fi
if [ -f ${NM_TMPFOLDER}/${ditem}.errtime ]; then
toterrtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${ditem}.errtime)
else
toterrtime=`date +%s`-$(stat -c %Y ${NM_TMPFOLDER}/${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 "${idsCL[LightRed]}${idsST[Bold]}${ignsel}${idsST[Reset]}${idsCL[LightRed]}${itemname}${spc}${host}${spc2}$(SHOW_TIME ${toterrtime})${idsCL[Default]}"
DIVIDER false darkGray 90
((is++))
done
echo
if [ "${1}" == "ignore" ]; then
IFS=$'\n'
read -rd '' -a DOWNLIST <<<"${DOWN_LIST}"
unset IFS
echo -en "${idsCL[LightCyan]}Enter # to change notifications: ${idsCL[Default]}"
read -n 1 choice
echo "HERE: ${DOWNLIST[$(expr ${choice}-1)]}"
fi
fi
if [ -z $action ] || [ "${action}" = "gui" ]; then