Managed Service for Prometheus provides a standard remote write interface, which allows you to import monitoring data from open source Prometheus to 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 ARMS
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 Application Real-Time Monitoring Service (ARMS).
Log on to the RAM console as a RAM administrator or with an Alibaba Cloud account.
In the left-side navigation pane, choose .
On the Permission page, click Grant Permission.
In the Principal section of the Grant Permission panel, select the RAM user to whom you want to grant read and write permissions.
In the Policy section, search for the
AliyunARMSFullAccess
policy, click the policy name to add it to the Selected Policy list, and then click Grant permissions.NoteAliyunARMSFullAccess
: provides full permissions on ARMS. After you attach this policy to a RAM user, the RAM user has full permissions on instances managed in ARMS. For example, the RAM user can view, modify, and delete instances.
Step 2: Obtain a remote write URL
Log on to the Managed Service for Prometheus console.
In the left-side navigation pane, click Instances.
In the top navigation bar, select the region where your Prometheus instance resides. On the Instances page, find the instance that you want to manage and click Settings in the Actions column.
On the Settings tab, copy the remote write URL for importing data over the Internet or internal network.
Step 3: Configure open source Prometheus
Install open source Prometheus. For more information, see DOWNLOAD.
Open the configuration file named Prometheus.yml, 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, 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
NoteThe 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
Log on to the Managed Service for Prometheus console
In the left-side navigation pane, click Instances.
In the top navigation bar, select the region where your Managed Service for Prometheus instance resides. Then, click the name of the Managed Service for Prometheus instance to which the monitoring data is imported.
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.