Skip to main content

Integrate OpenSearch Dashboards with Advanced Managed Prometheus

Learn how to integrate OpenSearch Dashboards with Advanced Managed Prometheus.

Basic information
  • Estimated time: 20 minutes
  • Recommended OS: macOS, Ubuntu
  • Prerequisites
    • Create an Advanced Managed Search cluster
    • Create an Advanced Managed Prometheus workspace
    • Create an access key for Advanced Managed Prometheus integration

About this scenario

This tutorial helps you integrate fragmented monitoring environments for logs (AMS) and metrics (AMP) into a single observability environment, so you can analyze infrastructure status and application logs together when an incident occurs.

In this tutorial, you register a Prometheus data source in OpenSearch Dashboards to configure the following integrated observability environment.

  • View logs (OpenSearch) and metrics (Prometheus) in a single UI
  • Analyze causes with logs when metric anomalies occur
  • Improve operational dashboard and observability usage

Before you start

Before starting this tutorial, create an Advanced Managed Search cluster and an Advanced Managed Prometheus workspace by referring to Create and manage clusters and Create and manage workspaces.

info

The API requests in this tutorial are called against the Advanced Managed Search cluster endpoint.

On the cluster details page, check the Endpoint and master user account information. Then prepend the cluster endpoint to the API path (/...) in each example before running the request.

Example: https://<AMS_ENDPOINT>/_plugins/_query/_datasources

Getting started

Step 1. Register a Prometheus data source

Register a Prometheus data source to query AMP from OpenSearch Dashboards.

POST _plugins/_query/_datasources
{
"name": "amp-prometheus",
"connector": "prometheus",
"allowedRoles": ["all_access"],
"properties": {
"prometheus.uri": "${READ_ENDPOINT}",
"prometheus.auth.type": "kakaocloudauth",
"prometheus.auth.region": "${REGION}",
"prometheus.auth.credential_id": "${CREDENTIAL_ID}",
"prometheus.auth.credential_secret": "${CREDENTIAL_SECRET}"
}
}
환경변수설명
READ_ENDPOINT🖌Enter the Read endpoint of the workspace created in the KakaoCloud console, excluding /api/v1/query
REGION🖌Region where the workspace was created, for example kr-central-2
CREDENTIAL_ID🖌User access key ID
CREDENTIAL_SECRET🖌User secret access key
info

allowedRoles specifies the OpenSearch security roles that can use the Prometheus data source. This tutorial uses the default administrator role, all_access. In production, you can change it to a role that matches your organization's security policy.

caution

For prometheus.uri, enter the Read (Query) endpoint, not the Write endpoint. When entering the Read endpoint, exclude /api/v1/query after the workspace ID.

Step 2. Verify data source registration

Query the registered data source to verify that it was created correctly. Run the request below in OpenSearch Dashboards > Dev Tools.

GET _plugins/_query/_datasources

If the amp-prometheus data source appears with "status": "ACTIVE" in the response, it was created correctly.

Step 3. View metrics in OpenSearch Dashboards

In OpenSearch Dashboards, go to:

  • Observability > Metrics

Select the registered Prometheus data source and run a PromQL query to verify that metrics are queried correctly.

info

If you cannot access OpenSearch Dashboards, refer to External access to OpenSearch Dashboards (nginx).

caution
  • Label-based queries are required: Prometheus queries without metadata (labels) may be restricted.
    • Example: Instead of querying http_requests_total alone, specify a label such as http_requests_total{service="my-service"}.
  • Data retention period: Label-based metric data is available for up to 90 days from its creation date.