Skip to main content

Using Metric Export

You can use the Metric Export endpoint provided by the Monitoring service to view KakaoCloud Monitoring data from third-party applications. The following describes how to use Grafana, an open-source software for visualizing and analyzing Time Series Database (TSDB) data.

info
  • Warning messages may occur when using certain features like Alarm Rules.
  • The Metric Export path /metric is available only until December 31, 2024.

Provided APIs

Monitoring Metric Export offers the following APIs. Each API is compatible with the Prometheus HTTP API.

ItemDescription
/metric-export/grafana/:id/prometheus/api/v1/seriesReturns a list of time series matching a specific label set.
/metric-export/grafana/:id/prometheus/api/v1/query_rangeReturns query results for a specified time range.
/metric-export/grafana/:id/prometheus/api/v1/queryReturns query results for a single point in time.
/metric-export/grafana/:id/prometheus/api/v1/metadataReturns metadata for metrics.
/metric-export/grafana/:id/prometheus/api/v1/labelsReturns a list of label names.
/metric-export/grafana/:id/prometheus/api/v1/label/:labelName/valuesReturns a list of label values for a specified label name.

Supported Metrics for Export

The Metric Export feature allows you to view all metrics provided by KakaoCloud Monitoring within your project.
For detailed information, please refer to Monitoring Metrics.

Grafana guide

Prerequisites

1. Install Grafana

To use Grafana, you may need to set up an environment depending on your system. You can install Grafana either by building it directly or by using a Docker image. For detailed installation instructions, please refer to the Official Grafana Guide.

  • This guide is based on Grafana v8.5.27.
2. Confirming the Metric Export Endpoint

The Metric Export endpoint is structured as follows. {project_id} is the project ID for your user.

Monitoring Grafana Export Endpoint Format
kr-central-2 : https://monitoring.kr-central-2.kakaocloud.com/metric-export/grafana/{project_id}/prometheus
3. Get access key

To use the Metric Export API, you need to issue an access key. Refer to the Get access key document to obtain your access key ID and secret access key.

Create Prometheus data source

KakaoCloud Monitoring supports the Prometheus data format. To create a data source in KakaoCloud Monitoring, follow these steps:

  1. Go to the Connections > Data sources page in the left menu of Grafana.

  2. Click the [Add data source] button to create a new data source.

    Image Grafana - creating a data source

  3. Select the Prometheus data source type.

  4. In the HTTP section, enter the Metric Export endpoint in the Prometheus server URL.

    Image Grafana - entering endpoint

  5. In the Custom HTTP Headers section, click the [Add header] button and enter the following information.

    Image Grafana - entering information

    FieldDescription
    Credential-IDAccess key ID
    Credential-SecretSecret access key
    service-typeEnter the service type for the data source
    - Supported services (input value):
    ᄂ Virtual Machine, GPU, Bare metal Server (input: server)
    ᄂ Mysql (input: mysql)
    ᄂ MemStore (input: memstore)
    ᄂ Load Balancing (input: lb)
  6. Click the [Save & test] button at the bottom to save the configuration.

View monitoring metrics

You can view the metrics provided by the Monitoring API using the configured data source.

  1. Go to the Explore page in the left menu of Grafana.

  2. Select the Prometheus data source created earlier.

  3. Specify the metric from the metric list.

  4. Use Run query in the top right to view the time-series data for the metric, as shown below.

    Image Grafana - time-series data

Configure custom dashboard

You can use KakaoCloud monitoring data to create a custom Grafana dashboard.

  1. Go to the Dashboards page in the left menu of Grafana.

  2. Click the [New] button on the right and select New dashboard.

  3. Choose Add visualization and select the Prometheus data source created earlier.

  4. Complete your dashboard configuration and click [Save] in the upper-right corner to save the dashboard. You can set up a dashboard as shown below.

    Image Grafana - custom dashboard

Billing unit: QSP

Metric Export is billed using the Query Samples Processed (QSP) unit. QSP refers to the number of data points (samples) processed in response to a query request.

QSP example

QSP varies based on query type (instant, range), step minimum settings, and other user configurations.

Image Custom Grafana graph view

Example QSP calculation
  1. With the query set as follows in Grafana and assuming no empty data points over one hour, data points are calculated as shown below.

    Query example
       {
    query: sum by(instance_id) (mysql_uptime), # query
    range: 1h, # time range for query
    step: 15s # interval between data points
    }

    3600secs(range) / 15s (step) = 240

  2. Multiply the series count shown in the metric, yielding a calculation of 240 * 2 = 480 QSP.

  3. To account for the starting point, add one point per series, resulting in a total of 482 QSP.

  4. When applying functions like rate, data processing occurs over the interval for a specified timeframe.

    Function example
    rate(cpu_usage[5m]) function applied
    # Rate calculated over 5 minutes, with original data sampled at 30-second intervals, leading to 'a total of 10 data samples' over 5 minutes.