Monitoring Kong Gateway in Instana with Prometheus

K M Abhijith
IBM Cloud
Published in
3 min readJan 4, 2023

​​​Co-authors: Swathi Kannan, Vaishak A

Background

Instana is a product that helps you conduct both monitoring and observability. It collects data and automatically analyses it by using an intelligent Instana backend. This helps in troubleshooting and optimization.

Kong is an Orchestration Microservice API Gateway that provides a flexible abstraction layer and securely manages communication between clients and micro services.

Prometheus is an open-source monitoring and alerting tool. The metrics information that is collected by Prometheus is stored with the timestamp at which it was recorded.

You can monitor Kong gateway by using Prometheus and Instana.

Ready to try? Follow this guide…

Prerequisites

  • Ensure that the Instana agent is installed and is reporting to your Instana backend.
  • Ensure that Kong is installed on the same VM/environment where the Instana agent is installed.

Installing and configuring Instana agent

Instana agents are available for both standalone VMs and cluster environments such as a Kubernetes cluster or an OpenShift cluster.

The following configurations are used to deploy and configure Instana agents in a Standalone VM:

  • Download the agent package. Follow these steps to install the package.
  • After you download the required deb/rpm package, run the following command to install the agent:
Debian derivatives: sudo apt install ./<Package_name>
Redhat derivatives: rpm -i <Package_name>

For more information about agent configurations, go here.

Kong Installation

Kong can be installed in a variety of operating systems and in a cluster environment. For more information about installation and configuration, go here.

Configuring Prometheus plugin in Kong API

Kong supports the Prometheus plugin, which can be used to visualise the metrics on the Instana UI.

Configuring the Prometheus plugin in Kong Gateway will expose an endpoint /metrics in Kong.

curl -X POST http://localhost:8001/plugins/ \
--data "name=prometheus" \
--data "config.per_consumer=true" \
--data "config.status_code_metrics=true"\
--data "config.latency_metrics=true" \
--data "config.bandwidth_metrics=true" \
--data "config.upstream_health_metrics=true"

For more information about the configuration of the plugin, follow this link.

Configuring Prometheus plugin in Instana agent

To monitor Prometheus by using Instana, you don’t need to install a Prometheus server. The Prometheus sensor directly captures the metrics from the endpoints exposed by the system.

Steps:

1. To configure the Prometheus plugin on your Instana agent, update your YAML file in the directory <agent_install_dir>/etc/instana/configuration.yaml with the following details.

2. On the Instana backend, you can see that the Prometheus dashboard is linked on the host dashboard page. Metrics that are related to Prometheus are listed as follows:

3. Follow these steps to create a dashboard to monitor specific metric data, which you are fetching by using the script.

a. Switch to the main page on Instana UI.

b. Click Create Dashboard.

c. Select the Prometheus metrics that are specific to your host by applying a filtering mechanism. The dashboard will be displayed.

More information

If you want to find out more about Instana and its monitoring capabilities, go here.

--

--