Send open source Prometheus data via remote write

Updated at:

Managed Service for Prometheus provides a standard remote write interface to send monitoring data from open source Prometheus. This lets you centralize the collection and visualization of your custom data on the Alibaba Cloud observability platform. This topic describes how to use a remote write URL to send data from an Managed Service for Prometheus server to a Managed Service for Prometheus instance.

Limitations

The remote write interface does not support HTTP/2.

Prerequisites

You have created a Managed Service for Prometheus instance. For more information, see Create an instance.

Step 1: Grant a RAM user read and write permissions for ARMS

If you created your Prometheus instance with an Alibaba Cloud account and want to use the AccessKey ID and AccessKey Secret of a RAM user to send data, you must first grant that RAM user read and write permissions on ARMS.

  1. Log on to the RAM console with your Alibaba Cloud account or as a RAM administrator. In the left-side navigation pane, choose Permission Management > Authorize.

  2. On the Authorize page, click Create Authorization. On the Create Authorization page, configure the following parameters.

    Parameter

    Description

    Resource Range

    Select a resource scope as needed.

    Principal

    Specify the RAM user to whom you want to grant permissions.

    Policy

    Select AliyunARMSFullAccess.

    Note

    AliyunARMSFullAccess is the full-permission policy for ARMS. After you attach this policy to a RAM user, the user can view, edit, and delete all sub-product instances.

  3. Click OK, and then click Close.

Step 2: Obtain the remote write URL

  1. Log on to the Cloud Monitor console.

  2. In the navigation pane on the left, choose Managed Service for Prometheus > Instances to open the instance list for Managed Service for Prometheus.

  3. Click the name of your target instance.

  4. On the Settings tab, copy the remote write URL for the internet or internal network.

    image

Step 3: Configure open source Prometheus

  1. Install Prometheus. For more information, see the Prometheus download page.

  2. Edit the prometheus.yml configuration file. Add the following content to the end of the file, replace the placeholder URL under remote_write with the URL that you obtained in Step 2, 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 this with your remote write URL.
      - url: "http://ts-xxxxxxxxxxxx.hitsdb.rds.aliyuncs.com:3242/api/prom_write"
        basic_auth:   
          # The username and password correspond to the AccessKey ID and AccessKey Secret of your Alibaba Cloud account.
          username: access-key-id
          password: access-key-secret
    Note
    • For the Managed Service for Prometheus remote write URL, regardless of whether you use the internet or an internal network, you must configure the username and password. These correspond 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 was created by 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 for Managed Service for Prometheus. For details, see Step 1 above.

Step 4: View open source Prometheus data

  1. Log on to the Managed Service for Prometheus console

  2. In the navigation pane on the left, choose Managed Service for Prometheus > Instances to open the instance list for Managed Service for Prometheus.

  3. In the top navigation bar, select the target region, and then click the name of your Managed Service for Prometheus instance.

  4. In the left-side navigation pane, click Dashboards, and then click the name of the target dashboard to view the data.