Alibaba Cloud Prometheus Service provides remote read endpoints and remote write endpoints. You can use the endpoints to remotely store monitoring data. This topic describes how to use the remote read and remote write endpoints to write monitoring data from open source Prometheus to Alibaba Cloud Prometheus Service.

Step 1: (Optional) Grant the read and write permissions on Application Real-Time Monitoring Service (ARMS) to a RAM user

You created the Alibaba Cloud Prometheus instance by using your Alibaba Cloud account and you want to use the AccessKey ID and AccessKey secret of a RAM user within your Alibaba Cloud account to perform remote read and write operations. In this case, you must grant read and write permissions on ARMS to the RAM user.

  1. Use your Alibaba Cloud account to log on to the RAM console.
  2. In the left-side navigation pane, choose Permissions > Grants.
  3. On the Grants page, click Grant Permission.
  4. On the Grant Permission page, set the Principal parameter to the username of the RAM user to whom you want to grant read and write permissions.
  5. On the System Policy tab in the Select Policy section, enter a policy name in the search box to search for a policy. In the search result, click the policy name to add the policy to the Selected section on the right. Then, click OK.
    The following policies must be added:
    • AliyunARMSFullAccess
    • AliyunARMSReadOnlyAccess
    Grant read and write permissions on ARMS to a RAM user

Step 2: Obtain the remote read and remote write endpoints

  1. Log on to the ARMS console .
  2. In the left-side navigation pane, choose Prometheus Monitoring > Prometheus Instances.
  3. On the Prometheus Monitoring page, select the region where the Prometheus instance that you want to manage is created and click Settings in the Actions column of the instance.
  4. On the page that appears, click the Settings tab.
  5. On the Settings tab, copy the public or private remote read and remote write endpoints based on your business requirements.
    Obtain the remote read and remote write endpoints

Step 3: Configure open source Prometheus

  1. Install open source Prometheus. For more information, see Prometheus documentation.
  2. Open the Prometheus.yaml configuration file and append the following content to the file. Replace the remote_write and remote_read URLs with the endpoints that you obtained in Step 2. Then, save the file.
    global:
      scrape_interval:     15s
      evaluation_interval: 15s
    scrape_configs:
      - job_name: 'prometheus'
        static_configs:
        - targets: ['localhost:9090']
    remote_write:
      // Set the url parameter to the remote write endpoint that you obtained. 
      - url: "http://ts-xxxxxxxxxxxx.hitsdb.rds.aliyuncs.com:3242/api/prom_write"
        basic_auth:   
          // Set the username and password parameters to the AccessKey ID and AccessKey secret of your Alibaba Cloud account. 
          username: access-key-id
          password: access-key-secret
    remote_read:
      // Set the url parameter to the remote read endpoint that you obtained. 
      - url: "http://ts-xxxxxxxxxxxx.hitsdb.rds.aliyuncs.com:3242/api/prom_read"
        read_recent: true
    Note
    • Alibaba Cloud Prometheus Service provides public and private remote read and remote write endpoints. For both endpoint types, you must set the username and password parameters.
    • Set the username and password parameters 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.
    • You created the Alibaba Cloud Prometheus instance by using your Alibaba Cloud account and you want to use the AccessKey ID and AccessKey secret of a RAM user within your Alibaba Cloud account to perform remote read and write operations. In this case, you must grant read and write permissions on ARMS to the RAM user. For more information, see Step 1.

View the monitoring data of open source Prometheus

After you run open source Prometheus, you can view the monitoring data of open source Prometheus on a Grafana dashboard.

  1. Log on to the ARMS console .
  2. In the left-side navigation pane, choose Prometheus Monitoring > Prometheus Instances.
  3. In the top navigation bar of the Prometheus console, select the region where the Prometheus instance to which the monitoring data of open source Prometheus is written resides. Then, click the name of the instance.
  4. On the Dashboards page, click the name of dashboard that you want to view.