Add Consul health check support for message-router 09/14609/2
authorgfraboni <gino.fraboni@amdocs.com>
Fri, 22 Sep 2017 13:40:53 +0000 (09:40 -0400)
committerGino Fraboni <gino.fraboni@amdocs.com>
Fri, 22 Sep 2017 14:25:19 +0000 (14:25 +0000)
This push adds health checks for the following message-router
components:  DMaaP, Kafka, and ZooKeeper.

Issue-ID: OOM-86

Change-Id: Icb557a27208eea94ea7ee6d8eadfb1f02481d7b4
Signed-off-by: gfraboni <gino.fraboni@amdocs.com>
kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-dmaap-health.json [new file with mode: 0644]
kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-kafka-health.json [new file with mode: 0644]
kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-zookeeper-health.json [new file with mode: 0644]
kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mr-kafka-health.sh [new file with mode: 0644]
kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mr-zookeeper-health.sh [new file with mode: 0644]

diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-dmaap-health.json b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-dmaap-health.json
new file mode 100644 (file)
index 0000000..bd01bc5
--- /dev/null
@@ -0,0 +1,10 @@
+{
+  "service": {
+    "name": "Health Check: Message Router - DMaaP",
+    "check": {
+      "http": "http://dmaap.onap-message-router:3904/topics",
+      "interval": "30s",
+      "timeout": "1s"
+    }
+  }
+}
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-kafka-health.json b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-kafka-health.json
new file mode 100644 (file)
index 0000000..128cf94
--- /dev/null
@@ -0,0 +1,10 @@
+{
+ "service": {
+   "name": "Health Check: Message Router - Kafka",
+   "check": {
+     "script": "/consul/config/scripts/mr-kafka-health.sh",
+     "interval": "30s",
+     "timeout": "1s"
+   }
+ }
+}
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-zookeeper-health.json b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mr-zookeeper-health.json
new file mode 100644 (file)
index 0000000..5268747
--- /dev/null
@@ -0,0 +1,10 @@
+{
+ "service": {
+   "name": "Health Check: Message Router - ZooKeeper",
+   "check": {
+     "script": "/consul/config/scripts/mr-zookeeper-health.sh",
+     "interval": "30s",
+     "timeout": "1s"
+   }
+ }
+}
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mr-kafka-health.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mr-kafka-health.sh
new file mode 100644 (file)
index 0000000..317c2a6
--- /dev/null
@@ -0,0 +1,13 @@
+kafkapod=$(/consul/config/bin/kubectl -n onap-message-router get pod | grep -o "global-kafka-[^[:space:]]*")
+if [ -n "$kafkapod" ]; then
+   if /consul/config/bin/kubectl -n onap-message-router exec -it $kafkapod -- ps ef | grep -i kafka; then
+      echo Success. Kafka process is running. 2>&1
+      exit 0
+   else
+      echo Failed. Kafka is not running. 2>&1
+      exit 1
+   fi
+else
+   echo Failed. Kafka container is offline. 2>&1
+   exit 1
+fi
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mr-zookeeper-health.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mr-zookeeper-health.sh
new file mode 100644 (file)
index 0000000..3da456c
--- /dev/null
@@ -0,0 +1,13 @@
+zkpod=$(/consul/config/bin/kubectl -n onap-message-router get pod | grep -o "zookeeper-[^[:space:]]*")
+if [ -n "$zkpod" ]; then
+   if /consul/config/bin/kubectl -n onap-message-router exec -it $zkpod -- ps ef | grep -i zookeeper; then
+      echo Success. Zookeeper process is running. 2>&1
+      exit 0
+   else
+      echo Failed. Zookeeper is not running. 2>&1
+      exit 1
+   fi
+else
+   echo Failed. Zookeeper container is offline. 2>&1
+   exit 1
+fi