diff options
author | gfraboni <gino.fraboni@amdocs.com> | 2017-09-22 11:30:59 -0400 |
---|---|---|
committer | Gino Fraboni <gino.fraboni@amdocs.com> | 2017-09-22 17:37:37 +0000 |
commit | fe17bbe3206203c823eb5e6f726f24f14e87cbff (patch) | |
tree | 5505c461a5745eca5494c0d22f56edbca1986d9c | |
parent | 3e130463a0062cdb7aef9717c46ee5bc9958a32e (diff) |
Add Consul health check support for MSO
This push adds health checks for the MSO components.
Issue-ID: OOM-86
Change-Id: Ia8908e4225248f51c73d8d41aa8895cd6f9b511c
Signed-off-by: gfraboni <gino.fraboni@amdocs.com>
4 files changed, 73 insertions, 0 deletions
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 index 0000000000..354cd9ebab --- /dev/null +++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json @@ -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 index 0000000000..ba0afc0dce --- /dev/null +++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh @@ -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 index 0000000000..254a0445ce --- /dev/null +++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh @@ -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 index 0000000000..29ffd8fe4c --- /dev/null +++ b/kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh @@ -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 |