This commit is contained in:
2019-01-28 16:21:07 -06:00
parent f8ccdedd9b
commit e368581bde
2 changed files with 56 additions and 1 deletions

View File

@@ -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

3
run.sh
View File

@@ -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