When you run self-managed Prometheus instances alongside Managed Service for Prometheus, you need a way to centralize metrics without replacing your existing setup. The remote write interface lets you forward metrics from any self-managed Prometheus server to a Managed Service for Prometheus instance, so you can use Alibaba Cloud dashboards for all your monitoring data.
Prerequisites
Before you begin, make sure that you have:
A Managed Service for Prometheus instance. For more information, see the Create a Prometheus instance section of the Manage Prometheus instances topic
An AccessKey pair (AccessKey ID and AccessKey secret) for authentication. For more information, see Obtain an AccessKey pair
Grant a RAM user permissions on ARMS
Skip the following steps if you use an Alibaba Cloud account's own AccessKey pair. The following steps apply only when you use a Resource Access Management (RAM) user's AccessKey pair for remote write authentication.
If the Managed Service for Prometheus instance belongs to an Alibaba Cloud account but you use a RAM user's AccessKey pair for remote write, grant the RAM user full access to 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 target RAM user.
In the Policy section, search for
AliyunARMSFullAccess, click the policy name to add it to the Selected Policy list, and then click Grant permissions.NoteThe
AliyunARMSFullAccesspolicy grants full permissions on ARMS, including the ability to view, modify, and delete instances.
Obtain the remote write URL
Log on to the ARMS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region where your Prometheus instance resides. Find the target instance and click Settings in the Actions column.
On the Settings tab, copy the remote write URL. The Settings tab provides two remote write URLs:
URL type When to use Internet Your Prometheus server is outside Alibaba Cloud or in a different region Internal network Your Prometheus server runs in the same region on Alibaba Cloud 
Configure the Prometheus server
Install open source Prometheus. For more information, see Prometheus downloads.
Open
prometheus.ymland add theremote_writesection. Replace the placeholders with your actual values, then save the file.global: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: 'prometheus' static_configs: - targets: ['localhost:9090'] remote_write: - url: "<your-remote-write-url>" basic_auth: username: <your-access-key-id> password: <your-access-key-secret>Placeholder Description Example <your-remote-write-url>Remote write URL obtained in the previous section http://ts-xxxxxxxxxxxx.hitsdb.rds.aliyuncs.com:3242/api/prom_write<your-access-key-id>AccessKey ID of your Alibaba Cloud account or RAM user LTAI5tXxx<your-access-key-secret>AccessKey secret of your Alibaba Cloud account or RAM user xXxXxXxNoteThe
basic_authcredentials are required for both Internet and internal network remote write URLs. If you use a RAM user's AccessKey pair, grant the RAM user permissions on ARMS first.Restart or reload Prometheus to apply the new configuration.
Verify the data import
Log on to the ARMS console.
In the left-side navigation pane, choose .
In the top navigation bar, select the region where your instance resides. Click the instance name to open the instance details.
In the left-side navigation pane, click Dashboards. Click a dashboard name to verify that the imported metrics appear. If the dashboard shows metrics from your self-managed Prometheus instance, the remote write configuration is working correctly.
Limits
The remote write interface does not support HTTP/2.