aboutsummaryrefslogtreecommitdiffstats
path: root/sampleApp/ensureSdncStandby.sh
diff options
context:
space:
mode:
authorTschaen, Brendan (bptschaen) <bt054f@att.com>2018-05-25 16:01:18 -0400
committerTschaen, Brendan (bptschaen) <bt054f@att.com>2018-05-25 16:01:18 -0400
commit4adfe22e6cc067dea88f6468efb74c3208e909bb (patch)
tree6e3a81c6b7b440f17a887583672d3b3602003da2 /sampleApp/ensureSdncStandby.sh
parent660d3c95610fd80aef58e5c9637971efe5af22b9 (diff)
Initial code commit
Change-Id: I9e82864d57a0633aeb6e0107084a80ab926bede8 Issue-ID: MUSIC-77 Signed-off-by: Tschaen, Brendan (bt054f) <bt054f@att.com> Signed-off-by: Tschaen, Brendan (bptschaen) <bt054f@att.com>
Diffstat (limited to 'sampleApp/ensureSdncStandby.sh')
-rwxr-xr-xsampleApp/ensureSdncStandby.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/sampleApp/ensureSdncStandby.sh b/sampleApp/ensureSdncStandby.sh
new file mode 100755
index 0000000..b9e9864
--- /dev/null
+++ b/sampleApp/ensureSdncStandby.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+dir=`dirname $0`
+# query SDN-C cluster status
+clusterStatus=$( $dir/sdnc.cluster )
+
+if [ "ACTIVE" = "$clusterStatus" ];then
+ # check that standby cluster is healthy
+ health=$( $dir/sdnc.monitor )
+ if [ "FAILURE" = "$health" ];then
+ echo "Backup site is unhealthy - can't accept traffic!"
+ exit 1
+ fi
+
+ # assume transient error as other side transitions to ACTIVE
+ echo "Cluster is ACTIVE but PROM wants STANDBY! Panic!"
+ exit 0
+
+elif [ "STANDBY" = "$clusterStatus" ]; then
+ echo "Cluster is standing by"
+ exit 0
+fi
+
+echo "Unknown cluster status '$clusterStatus'"
+exit 1