Kong API Gateway
Introduction
Kong Gateway is a lightweight, fast, and flexible cloud-native API gateway. An API gateway is a reverse proxy that lets you manage, configure, and route requests to your APIs.
Getting Started
Compatibility
vuSmartMaps supports the monitoring of the Kong API Gateway metric using prometheus endpoint.
Data Collection Method
vuSmartMaps collects health and performance data for Kong API Gateway using VuNet's Internal Data Collector.
Prerequisites
Inputs for Configuring Data Source
- Kong API Server: The IP Address/FQDN of the Kong API server. This field is the key to identify each server you add here.
- Kong Server's Endpoint: The URL to Kong API Server endpoint. Eg: http://127.0.0.1, https://127.0.0.1, http://127.0.0.1:8080 or https://127.0.0.1:8080
- Period (in seconds): Time interval for polling data from the Kong API Server. Period should be between 60 seconds – 3000 seconds.
Firewall Requirement
To collect data from this O11ySource, ensure the following ports are opened:
| Source IP | Destination IP | Destination Port | Protocol | Direction |
|---|---|---|---|---|
| vuSmartMaps IP | Kong API Gateway | 8101* | TCP | Outbound |
*Before providing the firewall requirements, please update the port based on the customer environment.
Configuring the Target
Option 1 - Recommended Approach Using Status API
Step 1: Enable the Status API
Edit
kong.conf:
status_listen = 0.0.0.0:8100
Alternatively, using environment variables:
export KONG_STATUS_LISTEN=0.0.0.0:8100
Restart Kong:
kong restart
Step 2: Enable the Prometheus Plugin
Execute the following command:
curl -i -X POST http://localhost:8001/plugins
--data "name=prometheus"
Expected response:
{ "name": "prometheus", "enabled": true }
Step 3: Verify the Metrics Endpoint
Access the metrics endpoint:
curl http://localhost:8100/metrics
Expected output:
HELP kong_http_status HTTP status codes
TYPE kong_http_status counter
To monitor Kong Data Plane (DP) in a Hybrid deployment with Konnect:
Enable the Prometheus plugin:
The Prometheus plugin must be enabled (globally or for the desired services/routes) via Konnect so that the Data Plane exposes Kong metrics.
Enable the Status API:
Configure the Data Plane to expose the Status API, for example:
KONG_STATUS_LISTEN=0.0.0.0:8100
The metrics endpoint will then be:
http://<data-plane-host>:8100/metrics
Additional requirements:
Network access: The vuSmartMaps Server must be able to reach the Data Plane's Status API port (for example, 8100). Ensure firewalls, security groups, and Kubernetes network policies (if applicable) allow access.
Authentication (if configured): If the /metrics endpoint is protected, configure vuSmartMaps Server with the required authentication (headers, mTLS, etc.).
One scrape target per Data Plane: Each Data Plane exposes its own local metrics. Configure vuSmartMaps Server to scrape every Data Plane node; there is no central metrics endpoint that aggregates all DPs.
Option 2 - Access Metrics via Admin API
If the Status API is not enabled, metrics can also be accessed through the Admin API endpoint.
Metrics URL:
Verification command:
curl http://localhost:8001/metrics
Note: Using the Admin API endpoint for metrics exposure is not recommended in production environments.
Configuration Steps
Enablethe O11ySource.- Select the sources tab and press the
+button to add a new instance that has to be monitored. - Provide the required configurations:
- *Kong API Server
- *Kong Server's Endpoint
- *Period (in seconds)
- Click
Saveto close the data source window.
Metrics Collected
| Name | Description | Data Type |
|---|---|---|
| @timestamp | Timestamp at which the data is collected by agent | String |
| timestamp | Precise event timestamp with milliseconds | DateTime64(3) |
| target | Server from where the data is collected | String |
| tags_host | Server from where the data is collected | String |
| doc_type | Document type of the entry | String |
| tenant_id | Tenant ID for the metrics entry | LowCardinality(String) |
| bu_id | Business Unit ID for the entry | LowCardinality(String) |
| tags_url | URL endpoint from where the request is being made | String |
| tags_service | Service name related to the API | String |
| tags_route | Route associated with the API | String |
| tags_direction | Direction of the API call (inbound/outbound) | String |
| tags_code | HTTP status code | UInt16 |
| tags_shared_dict | Shared dictionary in use | String |
| tags_subsystem | Subsystem generating the metric | String |
| tags_kong_subsystem | Kong subsystem | String |
| tags_state | State of the request | String |
| tags_node_id | Node ID of the Kong instance | String |
| metric_name | Name of the metric being recorded | String |
| metric_value | Value of the recorded metric | Float64 |
| metric_value_diff | Difference in metric value | Float64 |
| tags_pid | Process ID of the Kong instance | UInt32 |
| host | Host on which Kong is running | String |
| Port | Port of the Kong instance | String |
| tags_target | Target of the upstream service | String |
| tags_upstream | Upstream service in the request | String |
| tags_address | Address of the service or host | String |
