Managed Service for Prometheus provides a standard Remote Write endpoint that lets you send monitoring data from an open source Prometheus instance to a Managed Service for Prometheus instance for collection and display on the Alibaba Cloud monitoring platform.
Limits
The Remote Write endpoint does not support HTTP/2.
Prerequisites
A Managed Service for Prometheus instance is created. For more information, see Create an instance.
Step 1: Grant CMS read and write permissions to a RAM user
If your Prometheus instance was created by an Alibaba Cloud account and you need to use the AccessKey ID and AccessKey secret of a RAM user for remote read and write operations, grant the RAM user read and write permissions on CloudMonitor (CMS).
-
Log on to the Resource Access Management (RAM) console using an Alibaba Cloud account or a RAM administrator. In the navigation pane on the left, choose .
-
On the Authorization page, click Create Authorization. On the Create Authorization page, configure the following parameters.
Parameter
Description
Resource Scope
Select a resource scope as needed.
Principal
Select the RAM user that you want to authorize.
Policy
Select AliyunPrometheusMetricWriteAccess or AliyunCloudMonitorFullAccess.
-
Click OK, and then click Close.
Step 2: Obtain the Remote Write URL
-
Log on to the CloudMonitor console. In the navigation pane on the left, choose to go to the Instances page.
-
Click the name of the target instance.
-
On the Settings tab, copy the public or internal Remote Write URL as needed.
The Remote Write URLs are in the following formats:
-
Public URL:
https://cn-hangzhou.arms.aliyuncs.com/prometheus/xxx -
Internal URL:
http://cn-hangzhou-intranet.arms.aliyuncs.com/prometheus/xxx
The
xxxpart contains instance identifiers and other information. Refer to the actual page for details. -
Step 3: Configure open source Prometheus
-
Install Prometheus. For installation instructions, see Download Open Source Prometheus.
-
Edit the Prometheus.yml configuration file. Add the following content to the end of the file. Replace the
remote_writeURL with the URL that you obtained in Step 2: Obtain the Remote Write URL. 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: "https://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-secretNote-
Both the public and internal Remote Write URLs provided by Managed Service for Prometheus require authentication. Set the username to your AccessKey ID and the password to your AccessKey secret. For more information about how to obtain an AccessKey, see Obtain an AccessKey.
-
If your Managed Service for Prometheus instance was created by an Alibaba Cloud account and you want to use a RAM user's AccessKey ID and AccessKey secret for remote read and write operations, 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 data from your self-managed Prometheus instance in Alibaba Cloud Prometheus
-
Log on to the CloudMonitor console. In the navigation pane on the left, choose to go to the Instances page.
-
Click the name of the target instance.
-
In the navigation pane on the left, click Dashboards, and then click the name of the target dashboard to view the data.