Add Consul health check support for MSO 89/14689/2
authorgfraboni <gino.fraboni@amdocs.com>
Fri, 22 Sep 2017 15:30:59 +0000 (11:30 -0400)
committerGino Fraboni <gino.fraboni@amdocs.com>
Fri, 22 Sep 2017 17:37:37 +0000 (17:37 +0000)
This push adds health checks for the MSO components.

Issue-ID: OOM-86

Change-Id: Ia8908e4225248f51c73d8d41aa8895cd6f9b511c
Signed-off-by: gfraboni <gino.fraboni@amdocs.com>
kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json [new file with mode: 0644]
kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh [new file with mode: 0644]
kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh [new file with mode: 0644]
kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh [new file with mode: 0644]

diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json
new file mode 100644 (file)
index 0000000..354cd9e
--- /dev/null
@@ -0,0 +1,28 @@
+{
+  "service": {
+    "name": "Health Check: MSO",
+    "checks": [
+      {
+        "id": "mso-api-healthcheck",
+        "name": "MSO API Health Check",
+        "script": "/consul/config/scripts/mso-api-script.sh",
+        "interval": "10s",
+        "timeout": "1s"
+      },
+      {
+        "id": "mso-camunda-healthcheck",
+        "name": "MSO Camunda Health Check",
+        "script": "/consul/config/scripts/mso-camunda-script.sh",
+        "interval": "10s",
+        "timeout": "1s"
+      },
+      {
+        "id": "mso-jra-healthcheck",
+        "name": "MSO JRA Health Check",
+        "script": "/consul/config/scripts/mso-jra-script.sh",
+        "interval": "10s",
+        "timeout": "1s"
+      }
+    ]
+  }
+}
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh
new file mode 100644 (file)
index 0000000..ba0afc0
--- /dev/null
@@ -0,0 +1,15 @@
+## Query the health check API.
+HEALTH_CHECK_ENDPOINT="http://mso.onap-mso.svc.cluster.local:8080/ecomp/mso/infra/healthcheck"
+HEALTH_CHECK_RESPONSE=$(curl -s $HEALTH_CHECK_ENDPOINT)
+
+READY=$(echo $HEALTH_CHECK_RESPONSE | grep "Application ready")
+
+if [ -n $READY ]; then
+  echo "Query against health check endpoint: $HEALTH_CHECK_ENDPOINT"
+  echo "Produces response: $HEALTH_CHECK_RESPONSE"
+  echo "Application is not in an available state"
+  return 2
+else
+  echo "Application is available."
+  return 0
+fi
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh
new file mode 100644 (file)
index 0000000..254a044
--- /dev/null
@@ -0,0 +1,15 @@
+## Query the health check API.
+HEALTH_CHECK_ENDPOINT="http://mso.onap-mso.svc.cluster.local:8080/mso/healthcheck"
+HEALTH_CHECK_RESPONSE=$(curl -s $HEALTH_CHECK_ENDPOINT)
+
+READY=$(echo $HEALTH_CHECK_RESPONSE | grep "Application ready")
+
+if [ -n $READY ]; then
+  echo "Query against health check endpoint: $HEALTH_CHECK_ENDPOINT"
+  echo "Produces response: $HEALTH_CHECK_RESPONSE"
+  echo "Application is not in an available state"
+  return 2
+else
+  echo "Application is available."
+  return 0
+fi
diff --git a/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh
new file mode 100644 (file)
index 0000000..29ffd8f
--- /dev/null
@@ -0,0 +1,15 @@
+## Query the health check API.
+HEALTH_CHECK_ENDPOINT="http://mso.onap-mso.svc.cluster.local:8080/networks/rest/healthcheck"
+HEALTH_CHECK_RESPONSE=$(curl -s $HEALTH_CHECK_ENDPOINT)
+
+READY=$(echo $HEALTH_CHECK_RESPONSE | grep "Application ready")
+
+if [ -n $READY ]; then
+  echo "Query against health check endpoint: $HEALTH_CHECK_ENDPOINT"
+  echo "Produces response: $HEALTH_CHECK_RESPONSE"
+  echo "Application is not in an available state"
+  return 2
+else
+  echo "Application is available."
+  return 0
+fi