From fe17bbe3206203c823eb5e6f726f24f14e87cbff Mon Sep 17 00:00:00 2001 From: gfraboni Date: Fri, 22 Sep 2017 11:30:59 -0400 Subject: 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 --- .../consul/consul-agent-config/mso-health.json | 28 ++++++++++++++++++++++ .../consul-agent-config/scripts/mso-api-script.sh | 15 ++++++++++++ .../scripts/mso-camunda-script.sh | 15 ++++++++++++ .../consul-agent-config/scripts/mso-jra-script.sh | 15 ++++++++++++ 4 files changed, 73 insertions(+) create mode 100644 kubernetes/config/docker/init/src/config/consul/consul-agent-config/mso-health.json create mode 100644 kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-api-script.sh create mode 100644 kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-camunda-script.sh create mode 100644 kubernetes/config/docker/init/src/config/consul/consul-agent-config/scripts/mso-jra-script.sh (limited to 'kubernetes/config/docker/init') 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 -- cgit 1.2.3-korg