This commit is contained in:
Jakobus Schürz 2022-08-02 20:02:11 +02:00
parent 5ea462f314
commit 0831f7ed4f

View file

@ -1,5 +1,7 @@
#!/bin/bash
set -euo pipefail
function help() {
cat << EOF
@ -9,12 +11,19 @@ cat << EOF
Usage: $(basename $0) <action> <node>
$(basename $0) help
<action> [enable|disable|serverstate|showstat|showmaint]
<action> enable|disable|serverstate|showstat
<node> Nomenklatur ist <svc><cluster><env><node> (z.B. jra4t1 - Jira, Cluster 4 (ITSM), Test, Node 1)
<svc> [jra|cnf] 3 characters
<cluster> [0-9] 1 character
<env> [pte] 1 character
<node> [0-9] 1 character
<action> showmaint
<node> Nomenklatur ist <svc><cluster><env> (z.B. jra4t - Jira, Cluster 4 (ITSM), Test)
<svc> [jra|cnf] 3 characters
<cluster> [0-9] 1 character
<env> [pte] 1 character
help zeigt diese Hilfe
EOF
@ -73,7 +82,7 @@ case $COMMAND in
Cluster: $CLUSTER
Loadbalancers: ${LBS[*]}
Backend: ${BACKENDS[$i]}
What: ${WHAT}
What: ${WHAT:-not set}
------------------------------------
EOF
@ -91,7 +100,7 @@ EOF
Loadbalancers: ${LBS[*]}
Backend: ${BACKENDS[$i]}
Server: ${SERVERS[$i]}
What: ${WHAT}
What: ${WHAT:-not set}
------------------------------------
EOF
@ -99,15 +108,16 @@ EOF
case $ACTION in
enable|disable)
echo "echo '$ACTION server ${BACKENDS[$i]}/${SERVERS[$i]}'|socat stdio $HAADMINSOCK"
parallel-ssh -i $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION server ${BACKENDS[$i]}/${SERVERS[$i]}'|socat stdio $HAADMINSOCK"
parallel-ssh --inline-stdout $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION server ${BACKENDS[$i]}/${SERVERS[$i]}'|socat stdio $HAADMINSOCK"
;;
show)
echo "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"
parallel-ssh -i $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"
parallel-ssh --inline-stdout $(for l in ${LBS[@]};do echo -H $l;done) "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"
;;
showmaint)
UMG=t LBS=( sl${UMG}ebsatlassianlb01 sl${UMG}ebsatlassianlb02 )
UMG=p LBS=( ${LBS[@]} sl${UMG}ebsatlassianlb01 sl${UMG}ebsatlassianlb02 )
# UMG=t LBS=( sl${UMG}ebsatlassianlb01 sl${UMG}ebsatlassianlb02 )
# UMG=p LBS=( ${LBS[@]} sl${UMG}ebsatlassianlb01 sl${UMG}ebsatlassianlb02 )
echo UMG: ${UMG}
echo LBS: ${LBS[@]}
echo "echo '$ACTION $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"
parallel-ssh --inline-stdout $(for l in ${LBS[@]};do echo -H $l;done) "echo 'show $WHAT ${BACKENDS[$i]}'|socat stdio $HAADMINSOCK"| awk -F, '$1~/^\[[0-9][0-9]*/ {print $0} $18=="MAINT" {print "backend "$1" - "$2" "$18}'