From e368581bde883fa6d1021c7500a2462e1746218a Mon Sep 17 00:00:00 2001 From: David Schroeder Date: Mon, 28 Jan 2019 16:21:07 -0600 Subject: [PATCH] update --- nodemgmt-scripts.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++ run.sh | 3 ++- 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/nodemgmt-scripts.sh b/nodemgmt-scripts.sh index b457e8b4..51d93900 100755 --- a/nodemgmt-scripts.sh +++ b/nodemgmt-scripts.sh @@ -102,6 +102,60 @@ case "$1" in update) exit 0 ;; + + status) + echo "" + echo -e "${idsCL[Yellow]} NodeMgmt - Galera/NGINX Node Management${idsCL[Default]} ${idsCL[DarkGray]}(ver-${VERS})${idsCL[Default]}" + + nid=1 + for nip in "${NODE_HOSTS[@]}" + do + if [[ $(/sbin/ip -o -4 addr list ens192 | awk '{print $4}' | cut -d/ -f1) == *"${nip}"* ]]; then + nip='localhost' + NCMD='' + else + NCMD="ssh root@${nip}" + fi + + if [ $(${NCMD} pgrep mysql | wc -l) -gt "0" ]; then + SER_MYSQL="${idsCL[Green]}Running${idsCL[Default]}" + else SER_MYSQL="${idsCL[Red]}Not Running${idsCL[Default]}" + fi + if [ $(${NCMD} pgrep haproxy | wc -l) -gt "0" ]; then + SER_HAP="${idsCL[Green]}Running${idsCL[Default]}" + else SER_HAP="${idsCL[Red]}Not Running${idsCL[Default]}" + fi + if [ $(${NCMD} pgrep nginx | wc -l) -gt "0" ]; then + SER_NGINX="${idsCL[Green]}Running${idsCL[Default]}" + else SER_NGINX="${idsCL[Red]}Not Running${idsCL[Default]}" + fi + if [ $(${NCMD} pgrep keepalived | wc -l) -gt "0" ]; then + SER_KA="${idsCL[Green]}Running${idsCL[Default]}" + else SER_KA="${idsCL[Red]}Not Running${idsCL[Default]}" + fi + if [ $(${NCMD} pgrep gogs | wc -l) -gt "0" ]; then + SER_GOGS="${idsCL[Green]}Running${idsCL[Default]}" + else SER_GOGS="${idsCL[Red]}Not Running${idsCL[Default]}" + fi + if [ $(${NCMD} pgrep maxscale | wc -l) -gt "0" ]; then + SER_MS="${idsCL[Green]}Running${idsCL[Default]}" + else SER_MS="${idsCL[Red]}Not Running${idsCL[Default]}" + fi + + echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}" + echo -e "Node hostname: ${nip}" + echo -e "MySQL: ${SER_MYSQL}" + echo -e "NGINX: ${SER_NGINX}" + echo -e "Gogs: ${SER_GOGS}" + echo -e "HAProxy: ${SER_HAP}" + echo -e "Keepalived: ${SER_KA}" + echo -e "MaxScale: ${SER_MS}" + nid=`expr $nid + 1` + done + + echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}" + echo "" + ;; set-permissions) nid=1 diff --git a/run.sh b/run.sh index e4c1171b..7493b4b8 100755 --- a/run.sh +++ b/run.sh @@ -7,7 +7,7 @@ source /opt/idssys/defaults/colors.inc VERS=`mysql -h 10.5.10.56 -P 3308 -u sqluser -pdcs2057 -s -N -e "SELECT value FROM idssys.nodemgmt WHERE var = 'VERS'"` -if [ "$1" != "service" ] && [ "$1" != "" ]; then +if [ "$1" != "service" ] && [ "$1" != "status" ] && [ "$1" != "" ]; then if [ $(pgrep mysql | wc -l) -gt "0" ]; then SER_MYSQL="${idsCL[Green]}Running${idsCL[Default]}" else SER_MYSQL="${idsCL[Red]}Not Running${idsCL[Default]}" @@ -45,6 +45,7 @@ if [ "$1" != "service" ] && [ "$1" != "" ]; then echo -e "MaxScale: ${SER_MS}" echo -e "${idsCL[Yellow]}-------------------------------------------------------------${idsCL[Default]}" echo "" + if [ "$1" = "update" ]; then echo -en "${idsCL[LightCyan]}Checking for updates...${idsCL[Default]}" else echo -e "${idsCL[LightCyan]}Checking for updates...${idsCL[Default]}" fi