Skip to main content

Integrating Zabbix and Prometheus for Zabbix dashboard setup

Efficient cloud monitoring plays a critical role in modern business operations. This document guides you through using the Metric Export endpoint provided by KakaoCloud's Monitoring service to collect data and integrate Zabbix with Prometheus to comprehensively monitor cloud service performance, availability, and resource usage through a Zabbix dashboard.

Basic information
  • Estimated time: 30 minutes
  • User environment:
    • Region: kr-central-2
  • Prerequisites:
    • Zabbix Server 4.0+
    • Access key
info

The service is provided only for requests from VMs with Public IPs in kr-central-2 or VMs created in a VPC integrated with an internet gateway in kr-central-2.

Before you start

ItemDescription
Install Zabbix Server 4.0+Required to connect with the Metric Export endpoint
Access keyObtainable from your user profile in the KakaoCloud console

API endpoint

KakaoCloud Prometheus Metric Export endpoint (kr-central-2)
https://monitoring.kr-central-2.kakaocloud.com/metric/grafana/{project_id}/prometheus

API list

KakaoCloud's Monitoring service provides the following APIs for Monitoring Metric Export. Each API is compatible with the Prometheus HTTP API.

APIDescription
/metric/grafana/:id/prometheus/api/v1/seriesReturns a list of time series that match the label set.
/metric/grafana/:id/prometheus/api/v1/query_rangeReturns query results over a specified time range.
/metric/grafana/:id/prometheus/api/v1/queryReturns query results for a single point in time.
/metric/grafana/:id/prometheus/api/v1/metadataReturns metadata for metrics.
/metric/grafana/:id/prometheus/api/v1/labelsReturns a list of label names.
/metric/grafana/:id/prometheus/api/v1/label/:labelName/valuesReturns a list of values for the specified label name.

Supported metrics for export

The Metric Export feature allows you to view all metrics within your project provided by KakaoCloud's Monitoring service. For a list of supported metrics, refer to Monitoring Metrics > Key Metrics.

API usage example

Retrieve Metric Export metadata

Returns metadata about the metrics.

Request

Retrieve Metric Export metadata
curl -X GET https://monitoring.kr-central-2.kakaocloud.com/metric/grafana/{project_id}/prometheus/api/v1/metadata \
-H "Credential-ID: {ACCESS_KEY_ID}" \
-H "Credential-Secret: {ACCESS_KEY_SECRET}" \
-H "service-type: {SERVICE_TYPE}"
API call method
MethodRequest URL
GEThttps://monitoring.kr-central-2.kakaocloud.com/metric/grafana/{project_id}/prometheus/api/v1/metadata
PathTypeRequiredDescription
project_idStringRequiredKakaoCloud's Project ID
Request Header
ItemTypeRequiredDescription
Credential-IDStringRequiredAccess key ID
Credential-SecretStringRequiredAccess Security Key
service-typeStringRequiredThe type of service to query data from. Supported services:
- server for Virtual Machine, GPU, Bare Metal Server
- mysql for MySQL
- redis for Redis
- lb for Load Balancing

Response

Metric Export metadata query result
{
"status":"success",
"data":{
"lb_bytes_in_persec":[
{
"type":"gauge",
"help":"인바운드 트래픽",
"unit":"bytes/s(IEC)"
}
],
"lb_bytes_out_persec":[
{
"type":"gauge",
"help":"아웃바운드 트래픽",
"unit":"bytes/s(IEC)"
}
]...
}
}

View Metric Export query

This returns the result of a query at a single point in time.

Request

Metric Export Query
curl -X POST https://monitoring.kr-central-2.kakaocloud.com/metric/grafana/{project_id}/prometheus/api/v1/query \
-H "Credential-ID: {ACCESS_KEY_ID}" \
-H "Credential-Secret: {ACCESS_KEY_SECRET}" \
-H "service-type: {SERVICE_TYPE}" \
-d "query={조회할 metric}"
API method
MethodRequest URL
POSThttps://monitoring.kr-central-2.kakaocloud.com/metric/grafana/{project_id}/prometheus/api/v1/query
PathTypeRequiredDescription
project_idStringRequiredKakaoCloud's Project ID
Request header
HeaderTypeRequiredDescription
Credential-IDStringRequiredAccess key ID
Credential-SecretStringRequiredAccess Security Key
service-typeStringRequiredInput the service type to query from:
- Supported services:
ᄂ Virtual Machine, GPU, Bare Metal Server (input: server)
ᄂ MySQL (input: mysql)
ᄂ Redis (input: redis)
ᄂ Load Balancing (input: lb)
Request body
ParameterTypeRequiredDescription
queryStringRequiredMetric to query

Response

Metric Export Query lb_bytes_in_persec query result
{
"status":"success",
"data":{
"resultType":"vector",
"result":[
{
"metric":{
"__name__":"lb_bytes_in_persec",
"lb_id":"c9d6eefe-b100-4663-8114-6fdc7f9d53c9",
"lb_type":"Network",
"listener_id":"9bf3d454-dfbd-4861-bd59-729f12886e35"
},
"value":[
1702557658,
"0"
]
},
}
}

Zabbix-Prometheus integration

This guide explains how to set up a Zabbix dashboard using KakaoCloud's Monitoring Metric Export endpoint to monitor cloud service performance, availability, and resource usage comprehensively.

Create template

  1. In Zabbix, navigate to Data collection > Template groups. Click on [Create template group] to create a Zabbix templates group.

    ItemDescription
    Group name(Example) kakaocloud

    Create templates group

  2. Navigate to Data collection > Templates and click [Create template].

    Create templates

  3. Select the template group you created and click [Add].

    Select template group

Create items in template

  1. In the Name field, enter the template name and click Items.

    Create items

  2. Click [Create Item] to create an item for the template.

    Create item for template

  3. Fill in the following information and click [Add].

    FieldDescription
    NameName of the item
    TypeSelect HTTP agent
    KeyItem key
    Type of informationSelect Numeric
    ⚠️ Use Text for testing purposes
    URLhttps://monitoring.kr-central-2.kakaocloud.com/metric/grafana/{project_id}/prometheus/api/v1/query
    Request typePOST
    Request bodyquery={metric to query}
    Headers- Credential-ID: {ACCESS_KEY_ID}
    - Credential-Secret: {ACCESS_KEY_SECRET}
    - service-type: {SERVICE_TYPE}
    Update intervalInterval for data retrieval
  4. Perform a test to ensure the item retrieves the metrics correctly.

    caution

    For testing, change Type of information to Text. After testing, revert it to Numeric.

    1. Click [Test] and [Get value and test] to confirm the metrics are retrieved correctly.

      Test item

    2. In the Preprocessing tab, add preprocessing steps to extract specific metric values.

      Add preprocessing steps

      FieldDescription
      NameJSONPath
      ParametersExample: $.data.result[12].value[1]
      Use result[0], result[1], etc., depending on the number of load balancers.
    3. Click [Test] to confirm the value is processed correctly and click [Get value and test].

      Confirm test result

    4. After testing, save the item.

      info

      If you tested using Text format, revert the Type of information to Numeric to ensure graphs are displayed correctly.

Create graphs in template

  1. Go to Data collection > Templates > Graphs and click [Create graph].

    Create graph

  2. Fill in the fields and select the items created earlier to generate graphs.

    Graph configuration

    FieldValue
    NameName of the graph
    WidthGraph width
    HeightGraph height
    ItemsSelect items created earlier

Assign template

Assign the template to the Zabbix server.

  1. Go to Data collection > Hosts. Click on Zabbix server in the Name column, then click [Select] next to Templates.

    Assign template

  2. In the Templates window, select kakaocloud, check the KC-prometheus box, and click [Select].

    Select template

  3. Click [Update] to apply the changes.

Create dashboard

Create a dashboard to monitor cloud service performance, availability, and resource usage.

  1. Navigate to Dashboards and click [Create dashboard].

    Create dashboard

  2. Fill in the necessary fields.

    Dashboard settings

  3. To add a widget, set the type to Graph, select the Host and Item, and click [Add].

    Add widget

  4. View the added widget.

    Widget result