All Products
Search
Document Center

Managed Service for Prometheus:Import monitoring data from a Prometheus instance to MaxCompute

Last Updated:Sep 18, 2025

You can use the data delivery feature of Managed Service for Prometheus (Prometheus) to export monitoring data from a Prometheus instance to MaxCompute and then consume the data based on your business requirements. MaxCompute can process big data ingested from other data sources for data analysis and reports.

Prerequisites

Limitations

  • When you deliver the data in the virtual private cloud (VPC), if the VPC where the Prometheus instance resides is not the same as the target VPC, ensure that the IP address of the vSwitch in the target VPC has been added to the whitelist of the Prometheus instance. Otherwise, network connection may fail.

    On the vSwitch page in the VPC console, you can obtain the CIDR block of the vSwitch.444.jpg

  • The following table lists the instances that support data delivery.

    Instance

    Description

    Prometheus for Alibaba Cloud services

    The free instance, except for those starting with the name cloud-product-prometheus.

    Prometheus for container services

    N/A

    Prometheus for Flink Serverless

    N/A

    Prometheus for Kubernetes

    N/A

    General-purpose Prometheus instance

    The general-purpose instance, except for those whose data is reported through OpenTelemetry endpoints.

  • Only real-time data generated after you create a delivery task can be exported. Delivering historical data is not supported.

Billing

When you import data to MaxCompute, a Function Compute (FC) service is created. The prefix of the service is {task_name}_SINK_FC_TO_MAXCOMPUTE. Function Compute (FC) is used to write the monitoring data to MaxCompute. Therefore, a Function Compute fee is charged. Monitoring data is sent to Function Compute (FC) in batches. Therefore, the less number of times Function Compute (FC) is called, the less fee is charged. You can log on to the Function Compute console to view the status of the current Function Compute resource.

Step 1: Prepare MaxCompute resources

  1. Read the MaxCompute documentation and choose any method to connect to a MaxCompute project. For more information, see Select a connection tool.

  2. Determine the table schema: Map a column in the table schema to the tag name of the metric exported from Prometheus. If no metric value matches a column, a null value is inserted to the column. If multiple metrics are exported, the corresponding column name must be a union of the tag names of all metrics.

For example, you need to export the following two types of metrics:

Sample metrics 1

{
	"__name__": "metric1",
	"cluster_id": "***",
	"host": "***",
	"node_id": "***",
	"job": "***",
	"value": 347.51300048828125,
	"timestamp": 1703211584056
}

Sample metrics 2

{
	"__name__": "metric2",
	"cluster_id": "***",
	"job": "***",
  "instance": "****",
  "cpu": "1",
	"value": 1.0,
	"timestamp": 1703211584056
}

You need to create a SQL table in MaxCompute based on the following example. For more information, see the Use the SQL Analysis section of the SQL Analysis topic.

CREATE TABLE metric (
  __name__ 		VARCHAR(50) NOT NULL,
  cluster_id 	VARCHAR(50),
  host 				VARCHAR(50),
  node_id 		VARCHAR(50),
  job 				VARCHAR(50),
  instance 		VARCHAR(50),
  cpu 				VARCHAR(50),
  __value__ 			DOUBLE,
  timestamp		BIGINT
);
Note

Make sure that at least the following columns exist: __name__, __value__, and timestamp. These are basic tags used in Prometheus monitoring data. We recommend that you define the table schema based on your business requirement and make sure that all tags are mapped to columns in the table. If a key tag is not mapped, the table will receive large amounts of duplicate data.

Step 2: Create a data delivery task

  1. Log on to the Managed Service for Prometheus console.

  2. In the left navigation pane, click Data Delivery.

  3. On the Data Delivery page, select a region in the top navigation bar and click Create Task.

  4. In the dialog box that appears, set the Task Name and Task Description parameters, and click OK.

  5. On the Edit Task page, configure the data source and event target.

    1. Click + Add Data Source, set the parameters, and then click OK. The following table lists the parameters.

      Parameter

      Description

      Example

      Prometheus Instance

      The Prometheus instance whose data you want to deliver.

      c78cb8273c02*****

      Data Filtering

      The label of the metric to be filtered.

      Regular expressions are supported. Use line breaks to separate multiple conditions. The data can be delivered only when the relationship among the conditions is Logical AND.

      __name__=AliyunEcs_CPUUtilization|AliyunEcs_memory_usedutilization
      regionId=cn-hangzhou
      id=i-2ze0mxp.*

      Data Labeling

      The label you add to metric data to be delivered. Use line breaks to separate multiple labels.

      deliver_test_key1=ssss
      deliver_test_key2=yyyy
    2. Click Add Target, set the Destination Type parameter to MaxCompute, specify the required information, and then click OK.

  6. On the Edit Task page, click OK and Save.

Step 3: Verify that monitoring data is imported to MaxCompute

In the SQL code editor, enter the following SQL statement to query data in the metric table and click Run. On the Run Result tab, you can view the query result.

select * from metric limit 20;