All Products
Search
Document Center

CloudMonitor:Import data from open-source Prometheus to a Managed Service for Prometheus instance through a remote write URL

Last Updated:Apr 18, 2025

Managed Service for Prometheus provides a standard remote write interface for you to import monitoring data from open-source Prometheus to Managed Service for Prometheus. Then, you can collect and view custom data in Managed Service for Prometheus. This topic describes how to import monitoring data from open-source Prometheus to Managed Service for Prometheus through a remote write URL.

Limits

The remote write interface does not support HTTP/2.

Prerequisites

A Managed Service for Prometheus instance is created. For more information, see the Create a Prometheus instance section of the Manage Prometheus instances topic.

Step 1: Grant a RAM user read and write permissions on CloudMonitor

If your Prometheus instance is created by using an Alibaba Cloud account and you want to use the AccessKey ID and AccessKey secret of a Resource Access Management (RAM) user to perform remote read and write operations, you must first grant the RAM user read and write permissions on CloudMonitor.

  1. Log on to the RAM console as a RAM administrator or with an Alibaba Cloud account. In the left-side navigation pane, choose Permissions > Grants.

  2. On the Permission page, click Grant Permission. In the panel that appears, set the parameters listed in the following table.

    Parameter

    Description

    Resource Scope

    Set this parameter based on your business requirements.

    Principal

    The RAM user.

    Policy

    Select AliyunCloudMonitorFullAccess.

    Note

    AliyunCloudMonitorFullAccess provides full permissions on CloudMonitor. After you attach this policy to a RAM user, the RAM user has full permissions on instances managed in CloudMonitor. For example, the RAM user can view, modify, and delete instances.

  3. Click Grant permissions, and click Close.

Step 2: Obtain a remote write URL

  1. Log on to the CloudMonitor console. In the left-side navigation pane, choose Prometheus > Instance. The Instances page appears.

  2. Click the name of your Prometheus instance.

  3. On the Settings tab, copy the remote write URL for importing data over the Internet or internal network.

    image

Step 3: Configure open source Prometheus

  1. Install open-source Prometheus. For more information, see DOWNLOAD.

  2. Open the Prometheus.yml configuration file, add the following content to the end of the file, replace the URL below remote_write with the remote write URL you obtained in Step 2: Obtain a remote write URL, and then save the file.

    global:
      scrape_interval: 15s
      evaluation_interval: 15s
    scrape_configs:
      - job_name: 'prometheus'
        static_configs:
        - targets: ['localhost:9090']
    remote_write:
      # Replace with the remote write URL that you obtained. 
      - url: "http://ts-xxxxxxxxxxxx.hitsdb.rds.aliyuncs.com:3242/api/prom_write"
        basic_auth:   
          # Set username and password to the AccessKey ID and AccessKey secret of your Alibaba Cloud account. 
          username: access-key-id
          password: access-key-secret
    Note
    • The username and password parameters are required when you use the remote write URL provided by Managed Service for Prometheus for importing data over the Internet or internal network. Make sure that the parameters are set to the AccessKey ID and AccessKey secret of your Alibaba Cloud account. For more information about how to obtain an AccessKey pair, see Obtain an AccessKey pair.

    • If your Managed Service for Prometheus instance is created by using an Alibaba Cloud account and you want to use the AccessKey ID and AccessKey secret of a RAM user to perform remote read and write operations, you must first grant the RAM user read and write permissions on Managed Service for Prometheus. For more information, see Step 1 in this topic.

Step 4: View the imported Prometheus monitoring data in Managed Service for Prometheus

  1. Log on to the CloudMonitor console. In the left-side navigation pane, choose Prometheus > Instance. The Instances page appears.

  2. Click the name of your Prometheus instance.

  3. In the left-side navigation pane, click Dashboards. On the page that appears, click the name of the corresponding dashboard to view the monitoring data.