Software AG Products 10.7 | Configuring API Gateway | API Gateway Configuration | API Gateway Cluster Configuration | Configuring an API Gateway Cluster | API Gateway Availability and Health Status
 
API Gateway Availability and Health Status
You can monitor the availability and health status of API Gateway using the Availability REST API. The Availability API is used to report the overall health of the API Gateway.
The REST API is not deployed by default but can be defined by importing the Swagger file APIGatewayAvailability.json from the folder located at SAG_Root/IntegrationServer/instances/default/packages/WmAPIGateway/resources/apigatewayservices. For more information on API Gateway Availability, see API Gateway Availability.
You can check API Gateway health using the HTTP requests against http://localhost:5555/gateway/availability. This REST call also verifies the exposure and availability of the API Gateway REST API. You must have the View administration configurations privileges to invoke the Availability API to view the availability and health status of API Gateway.
Each health check request displays a status field as the first entry. The status can have the values green, yellow or red describing the overall status of the components to check. This means that when any of the components signals a problem, then the status is set to red. When the status is green and yellow, the request ends with HTTP 200, however when the status is red, then the request ends with HTTP 500.
The REST API provides the following resources and methods:
*GET /gateway/availability/admin
The request retrieves the availability and health status of the API Gateway administration service (UI, Dashboards).
Request: GET http://localhost:5555/gateway/availability/admin
The overall admin status is assessed based on the UI ports (the port can be HTTP or HTTPS) status as follows:
*When the HTTP and the HTTPS ports are accessible, the overall status is green.
*When both ports are configured and they are inaccessible, the overall status is red.
*When both ports are configured and one of the ports is inaccessible, the overall status is yellow.
*When there is a SSL handshake failure while checking the HTTPS port, the overall status is yellow.
The overall admin status is assessed based on the Kibana status as follows:
*When Kibana's port is accessible, the overall status is green.
*When Kibana's port is inaccessible, the overall status is red.
*When Kibana's communication with Elasticsearch is not established, the overall status is red.
A sample HTTP response looks as follows:
{
"status": "green",
"ui": {
"https_port_9073": "ok",
"http_port_9072" "ok",
"status": "green",
"response_time_ms": "727"
},
"kibana": {
"status": {
"overall": {
"state": "green",
"nickname": "Looking good"'
"icon": "success",
"uiColor": "secondary"
}
}
"response_time_ms": "78"

}
}
The sample HTTP response shows a green status as both the ports and Kibana are available.
*GET /gateway/availability/engine
The request retrieves the availability and health status of the API Gateway to process API invocations and requests (ElasticSearch cluster, IS and Terracotta).
The overall status is assessed based on the Elasticsearch status as follows:
*When the internal status of Elasticsearch signals green or yellow, the overall status is green.
*When the internal status of Elasticsearch signals red, the overall status is red.
*When Elasticsearch port is inaccessible, the overall status is red.
The overall status is assessed based on the IS status as follows:
*When one of the resource types memory, diskspace, and servicethread reveals a resource problem, then the overall engine status is set to yellow.
Request: GET http://localhost:5555/gateway/availability/engine
A sample HTTP response looks as follows:
{
"status": "green",
"elasticsearch": {
"cluster_name": "SAG_EventDataStore",
"status": "green",
"number_of_nodes": "3",
"number_of_data_nodes": "3",
"timed_out": "false",
"active_shards": "236",
"initializing_shards": "0",
"unassigned_shards": "0",
"task_max_waiting_in_queue_millis": "0",
"port_9240": "ok",
"response_time_ms": "29"
},
"is": {
"status": "green",
"diskspace": {
"status": "up",
"free": "8249233408",
"inuse": "2476650496",
"threshold": "1072588390",
"total": "10725883904"
},
"memory": {
"status": "up",
"freemem": "252558496",
"maxmem": "954728448",
"threshold": "55679385",
"totalmem": "556793856"
},
"servicethread": {
"status": "up",
"avail": "71",
"inuse": "4",
"max": "75",
"threshold": "7"
},
"response_time_ms": "315"
},
"cluster": {
"status": "green",
"isClusterAware": "false",
"message": "Non-Clustered node",
"response_time_ms": "16"
}
}
The overall status is green since all components work as expected.
*GET /gateway/availability/externalServices
The request retrieves the availability of external services accessed by API Gateway. The external services include destinations and external accounts. The checked external accounts include Service registries and Integration Servers.
The status field of externalServices displays the values green or yellow, if at least one of the destination resources is not available. In case of a problem, the error field displays the details of the problem encountered.
Request: GET http://localhost:5555/gateway/availability/externalServices
HTTP response looks as follows:
{
"status": "yellow",
"destinations": [
{
"type": "centrasite",
"name": "centrasite",
"status": "yellow",
"error": "Port 53307 not active",
"response_time_ms": "1006"
},
{
"type": "centrasite",
"name": "centrasite_snmp",
"status": "yellow",
"error": "Port 8181 not active",
"response_time_ms": "1005"
},
{
"type": "api_portal",
"name": "api_portal",
"status": "not configured",
"response_time_ms": "9"
},
{
"type": "snmp",
"name": "snmp",
"status": "yellow",
"error": "Port 8189 not active",
"response_time_ms": "1004"
},
{
"type": "email",
"name": "email",
"status": "green",
"response_time_ms": "9"
},
{
"type": "elasticsearch",
"name": "elasticsearch",
"status": "not configured",
"response_time_ms": "0"
}
],
"external_accounts": [
{
"type": "service_registry",
"name": "ServiceConsulDefault",
"status": "green",
"response_time_ms": "12"
},
{
"type": "service_registry",
"name": "EurekaDefault",
"status": "yellow",
"error": "Error: HttpResponse: 500 (Connect to http://daefermion3:9092 failed): ",
"response_time_ms": "1026"
}
]
}
The sample response shows the status of all external services including those that are not configured. As the CentraSite destination is not properly configured, as shown in the sample response, this turns the overall status to yellow.
*GET /gateway/availability/all
The request retrieves the availability of the administration service of the policy enforcement engine and of the external services accessed by API Gateway.
Request: GET http://localhost:5555/gateway/availability/all
HTTP response looks as follows:
{
"status": "green",
"ui": {
"https_port_9073": "ok",
"http_port_9072" "ok",
"status": "green",
"response_time_ms": "727"
},
"kibana": {
"status": {
"overall": {
"state": "green",
"nickname": "Looking good"'
"icon": "success",
"uiColor": "secondary"
}
}
"response_time_ms": "78"

},
"elasticsearch": {
"cluster_name": "SAG_EventDataStore",
"status": "green",
"number_of_nodes": "3",
"number_of_data_nodes": "3",
"timed_out": "false",
"active_shards": "236",
"initializing_shards": "0",
"unassigned_shards": "0",
"task_max_waiting_in_queue_millis": "0",
"port_9240": "ok",
"response_time_ms": "7"
},
"is": {
"status": "green",
"diskspace": {
"status": "up",
"free": "8249327616",
"inuse": "2476556288",
"threshold": "1072588390",
"total": "10725883904"
},
"memory": {
"status": "up",
"freemem": "232997664",
"maxmem": "954728448",
"threshold": "57094963",
"totalmem": "570949632"
},
"servicethread": {
"status": "up",
"avail": "71",
"inuse": "4",
"max": "75",
"threshold": "7"
},
"response_time_ms": "127"
},
"cluster": {
"status": "green",
"isClusterAware": "false",
"message": "Non-Clustered node",
"response_time_ms": "16"
},
"destinations": [
{
"type": "centrasite",
"name": "centrasite",
"status": "yellow",
"error": "Port 53307 not active",
"response_time_ms": "1006"
},
{
"type": "centrasite",
"name": "centrasite_snmp",
"status": "yellow",
"error": "Port 8181 not active",
"response_time_ms": "1005"
},
{
"type": "api_portal",
"name": "api_portal",
"status": "not configured",
"response_time_ms": "9"
},
{
"type": "snmp",
"name": "snmp",
"status": "yellow",
"error": "Port 8189 not active",
"response_time_ms": "1004"
},
{
"type": "email",
"name": "email",
"status": "green",
"response_time_ms": "9"
},
{
"type": "elasticsearch",
"name": "elasticsearch",
"status": "not configured",
"response_time_ms": "0"
}
],
"external_accounts": [
{
"type": "service_registry",
"name": "ServiceConsulDefault",
"status": "green",
"response_time_ms": "12"
},
{
"type": "service_registry",
"name": "EurekaDefault",
"status": "yellow",
"error": "Error: HttpResponse: 500 (Connect to http://daefermion3:9092 failed): ",
"response_time_ms": "1026"
}
]
}
Note: 
*To perform the following API Gateway Availability REST calls you must have the View Administration Configuration privileges.
*GET /gateway/availability/externalServices
*GET /gateway/availability/all
*To perform the following API Gateway Availability REST calls you must be a valid API Gateway user.
*GET /gateway/availability/admin
*GET /gateway/availability/engine
You can use the existing health check request GET http://localhost:5555/rest/apigateway/health, without any authentication being set, to retrieve the health of API Gateway that monitors the availability and health status of Kubernetes and Docker containers . This returns a HTTP 200 response without additional data.