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.
- 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.
Item | Description |
---|---|
/metric-export/grafana/:id/prometheus/api/v1/series | Returns a list of time series matching a specific label set. |
/metric-export/grafana/:id/prometheus/api/v1/query_range | Returns query results for a specified time range. |
/metric-export/grafana/:id/prometheus/api/v1/query | Returns query results for a single point in time. |
/metric-export/grafana/:id/prometheus/api/v1/metadata | Returns metadata for metrics. |
/metric-export/grafana/:id/prometheus/api/v1/labels | Returns a list of label names. |
/metric-export/grafana/:id/prometheus/api/v1/label/:labelName/values | Returns 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.
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:
-
Go to the Connections > Data sources page in the left menu of Grafana.
-
Click the [Add data source] button to create a new data source.
Grafana - creating a data source
-
Select the Prometheus data source type.
-
In the HTTP section, enter the Metric Export endpoint in the Prometheus server URL.
Grafana - entering endpoint
-
In the Custom HTTP Headers section, click the [Add header] button and enter the following information.
Grafana - entering information
Field Description Credential-ID Access key ID Credential-Secret Secret access key service-type Enter 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
) -
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.
-
Go to the Explore page in the left menu of Grafana.
-
Select the Prometheus data source created earlier.
-
Specify the metric from the metric list.
-
Use Run query in the top right to view the time-series data for the metric, as shown below.
Grafana - time-series data
Configure custom dashboard
You can use KakaoCloud monitoring data to create a custom Grafana dashboard.
-
Go to the Dashboards page in the left menu of Grafana.
-
Click the [New] button on the right and select New dashboard.
-
Choose Add visualization and select the Prometheus data source created earlier.
-
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.
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.
Custom Grafana graph view
Example QSP calculation
-
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
-
Multiply the series count shown in the metric, yielding a calculation of 240 * 2 = 480 QSP.
-
To account for the starting point, add one point per series, resulting in a total of 482 QSP.
-
When applying functions like
rate
, data processing occurs over the interval for a specified timeframe.Function examplerate(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.