diff --git a/inc/status.new.inc b/inc/status.new.inc index 118dd385..89c4a1fc 100755 --- a/inc/status.new.inc +++ b/inc/status.new.inc @@ -420,12 +420,13 @@ It was down for $(SHOW_TIME ${toterrtime})" } STATUS_NODE(){ - dockers=${NTYPE}_DOCKERS_CHECK[@] - hosts=${NTYPE}_HOSTS[@] + NODETYPE=${1} + dockers=${NODETYPE}_DOCKERS_CHECK[@] + hosts=${NODETYPE}_HOSTS[@] - var=${NTYPE}_HOSTS[@] + var=${NODETYPE}_HOSTS[@] - if ([[ ! -v ${NTYPE}_DOCKERS_CHECK ]] && [ "${ST_ACTION}" == "dockers" ]) || ([ "${NM_SERVICES_CHECK[${NTYPE}]}" == "" ] && [ "${ST_ACTION}" == "services" ]); then + if ([[ ! -v ${NODETYPE}_DOCKERS_CHECK ]] && [ "${ST_ACTION}" == "dockers" ]) || ([ "${NM_SERVICES_CHECK[${NODETYPE}]}" == "" ] && [ "${ST_ACTION}" == "services" ]); then GOFORCHECK=false; else GOFORCHECK=true; @@ -462,12 +463,12 @@ STATUS_NODE(){ fi # echo "HERE: $checkhost - $checkhostssl" if [ "${checkhost}" != "false" ] && [ "${checkhostssl}" == "ok" ]; then - [ "${NTYPE}" != "OFW" ] && cpu_usage=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} "/opt/idssys/defaults/get-data.sh cpu-usage") || cpu_usage="" + [ "${NODETYPE}" != "OFW" ] && cpu_usage=$(ssh -q -o ConnectTimeout=1 -o ConnectionAttempts=1 root@${nip} "/opt/idssys/defaults/get-data.sh cpu-usage") || cpu_usage="" if [ "${ST_ACTION}" != "check" ]; then if ([ "${ST_ACTION}" == "report" ] && [ "${2}" == "email" ]) || [ "${ST_ACTION}" != "report" ]; then - if [ "${NTYPE}" == "OFW" ]; then + if [ "${NODETYPE}" == "OFW" ]; then uptime=$(${NCMD} uptime | awk '{print $3}' | cut -d, -f1) if [ ${#uptime} -ge 6 ]; then uptime="up $(echo $uptime | cut -d: -f1) days, $(echo $uptime | cut -d: -f2) hours, $(echo $uptime | cut -d: -f3) minutes" @@ -499,13 +500,13 @@ STATUS_NODE(){ ######################## ## SERVICES CHECK ######################## - if [ "${ST_ACTION}" != "dockers" ] && [ "${NM_SERVICES_CHECK[${NTYPE}]}" != "" ]; then + if [ "${ST_ACTION}" != "dockers" ] && [ "${NM_SERVICES_CHECK[${NODETYPE}]}" != "" ]; then echo -e "${idsCL[Green]} System Service(s) Status${idsCL[Default]}" DIVIDER . green 52 - srvcs=${NTYPE}_SERVICES_CHECK[@]; + srvcs=${NODETYPE}_SERVICES_CHECK[@]; srvcstotest="$(join_by " " ${!srvcs})" - [ "${NTYPE}" != "OFW" ] && srvctst=(`${NCMD} "systemctl is-active ${srvcstotest}"`) + [ "${NODETYPE}" != "OFW" ] && srvctst=(`${NCMD} "systemctl is-active ${srvcstotest}"`) sr=0 for srvc in "${!srvcs}"; do if [ "${ST_ACTION}" != "report" ]; then @@ -515,9 +516,9 @@ STATUS_NODE(){ else spc=' ' fi - tmp=${NM_SINGLESRVR_SERVICES[${NTYPE}]} + tmp=${NM_SINGLESRVR_SERVICES[${NODETYPE}]} if [[ ${tmp[@]} =~ ${srvc} ]]; then - if [[ $(${NCMD} ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | cut -d'/' -f1) != *${NM_SINGLESRVR_IP[${NTYPE}]}* ]]; then + if [[ $(${NCMD} ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | cut -d'/' -f1) != *${NM_SINGLESRVR_IP[${NODETYPE}]}* ]]; then SSCHK=false rm -f ${NM_TMPFOLDER}/${nip}~${srvc}.* else @@ -531,7 +532,7 @@ STATUS_NODE(){ if [ ${SSCHK} != false ]; then [ "${ST_ACTION}" != "check" ] && echo -en "${idsCL[White]} ${NM_SERVICE_DESC[${srvc}]}${spc}${idsCL[Default]}: " - if [ "${NTYPE}" != "OFW" ]; then + if [ "${NODETYPE}" != "OFW" ]; then srvctest=${srvctst[$sr]} if [ "${srvctest}" != "active" ] && [ "${srvc}" == "mysql" ]; then [ "$(${NCMD} systemctl is-active mariadb)" == "active" ] && mysqlgo=true || mysqlgo=false @@ -603,9 +604,9 @@ STATUS_NODE(){ ######################## ## DOCKER CHECK ######################## - if [[ -v ${NTYPE}_DOCKERS_CHECK ]] && [ "${ST_ACTION}" != "services" ]; then + if [[ -v ${NODETYPE}_DOCKERS_CHECK ]] && [ "${ST_ACTION}" != "services" ]; then if [ "${ST_ACTION}" != "check" ]; then - [ "${ST_ACTION}" == "" ] && [ "${NM_SERVICES_CHECK[${NTYPE}]}" != "" ] && echo + [ "${ST_ACTION}" == "" ] && [ "${NM_SERVICES_CHECK[${NODETYPE}]}" != "" ] && echo echo -e "${idsCL[Green]} Docker Service(s) Status${idsCL[Default]}" DIVIDER . green 52 fi @@ -617,9 +618,9 @@ STATUS_NODE(){ else spc=' ' fi - tmp=${NM_SINGLESRVR_DOCKERS[${NTYPE}]} + tmp=${NM_SINGLESRVR_DOCKERS[${NODETYPE}]} if [[ ${tmp[@]} =~ ${docker} ]]; then - if [[ $(${NCMD} ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | cut -d'/' -f1) != *${NM_SINGLESRVR_IP[${NTYPE}]}* ]]; then + if [[ $(${NCMD} ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | cut -d'/' -f1) != *${NM_SINGLESRVR_IP[${NODETYPE}]}* ]]; then SDCHK=false rm -f ${NM_TMPFOLDER}/${nip}~${docker}.* else diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index e454325d..0d5e4551 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -865,7 +865,7 @@ GUI(){ DOWNLIST ${2} ;; statusnew) - STATUSNEW + STATUSNEW ${2} ${3} ;; status) if [ "${2}" == "freespace" ]; then