All Products
Search
Document Center

Managed Service for Prometheus:Connect Managed Service for Prometheus to a self-managed Grafana

Last Updated:Jun 16, 2026

You can view Managed Service for Prometheus data in your self-managed Grafana by adding the dedicated API endpoint provided by Managed Service for Prometheus as a Managed Service for Prometheus data source.

Prerequisites

You have a self-managed Grafana instance installed and running.

Step 1: Obtain the API endpoint

Obtain the API endpoint for connecting Managed Service for Prometheus to your self-managed Grafana:

  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 the instance to open its details page. In the navigation pane on the left, click Settings. On the Settings tab, copy the public or internal HTTP API endpoint based on your requirements.

    Note

    For a Prometheus instance created for a cloud service, select the HTTP API endpoint that corresponds to the type of the integrated cloud service.

    The HTTP API endpoint (for Grafana read) is available for both public and internal networks. Example of a public endpoint: http://cn-hangzhou.arms.aliyuncs.com:9090/api/v1/prometheus/{instance-id}. Example of an internal endpoint: http://cn-hangzhou-intranet.arms.aliyuncs.com:9090/api/v1/prometheus/{instance-id}. You can click the copy icon next to an endpoint to copy it.

  4. Optional: To enhance security for the Grafana connection, click Generate Token to get an authentication token for the Prometheus instance.

    Important

    After you obtain a token, you must configure it when you add the data source in Grafana. Otherwise, Grafana may fail to read data from Managed Service for Prometheus.

    Record the Token value. You can click the copy icon to copy it. Then, obtain the Remote Read endpoint. The public endpoint format is http://cn-hangzhou.arms.aliyuncs.com:9090/api/v1/prometheus/xxx/api/v1/read, and the internal endpoint format is http://cn-hangzhou-intranet.arms.aliyuncs.com:9090/api/v1/prometheus/xxx/api/v1/read. In these examples, xxx represents the actual instance ID displayed in the console.

Step 2: Log on to Grafana

  1. Log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.

  2. On the Workspace Management page, find the target workspace and click the URL to its right to open Grafana.

    Note

    If you are prompted to sign in, use the Grafana Admin account and password you configured for the workspace. Alternatively, click Sign in with Alibaba Cloud to sign in with the Alibaba Cloud account that you used to purchase the workspace.

Step 3: Add a data source

Add the API endpoint from Step 1 as a data source in Grafana:

Grafana 9.x

  1. In the left-side navigation pane of Grafana, choose image > Add data source.

  2. On the Add data source page, click Prometheus.

  3. On the Settings tab, enter a Name for the data source and paste the API endpoint from Step 1 into the URL field.

  4. Optional: In the Custom HTTP Headers section, click +Add header. Set the Header field to Authorization and the Value field to the authentication token from Step 1.

  5. Click Save & Test.

Grafana 10.x

  1. On the Grafana homepage, click the image icon.

  2. In the left-side navigation pane, choose Management > Data sources.

  3. On the Data sources tab, click + Add data source.

  4. On the Add data source page, click Prometheus.

  5. On the Settings tab, enter a Name for the data source and paste the API endpoint from Step 1 into the URL field.

  6. Optional: In the Custom HTTP Headers section, click +Add header. Set the Header field to Authorization and the Value field to the authentication token from Step 1.

  7. Click Save & Test.

Step 4: Create a dashboard panel

Grafana 9.x

  1. In the left-side navigation pane of Grafana, choose image > New dashboard.

  2. On the New dashboard page, click Add a new panel.

  3. On the Edit Panel page, on the Query tab, from the Data source drop-down list, select the data source that you added in Step 3.

  4. On the Query tab, in section A, select a metric and labels from the Metric and Labels drop-down lists, and then click Run queries.

  5. In the right-side pane, specify the name, type, and graph styles of the chart.

  6. Click Apply.

  7. In the upper-right corner, click the Save dashboard icon. Then, specify the name of the dashboard and the directory in which the dashboard resides.

  8. Click Save.

Grafana 10.x

  1. On the Grafana homepage, click the image icon.

  2. In the left-side navigation pane, click Dashboards. On the page that appears, select New dashboard from the New drop-down list.

  3. On the New dashboard page, click + Add visualization.

  4. In the Select data source dialog box that appears, select the data source that you added in Step 3.

  5. On the Query tab, in section A, select a metric and labels from the Metric and Labels drop-down lists, and then click Run queries.

  6. In the right-side pane, specify the name, type, and graph styles of the chart.

  7. Click Apply.

  8. In the upper-right corner, click the Save dashboard icon. Then, specify the name of the dashboard and the directory in which the dashboard resides.

  9. Click Save.

Step 5: View monitoring data

Grafana 9.x

  1. In the Grafana left navigation bar, click the image icon, and then click Browse.

  2. On the Browse tab, navigate to the folder where you saved your dashboard and click the dashboard to open it.

Grafana 10.x

  1. On the Grafana homepage, click the image icon in the upper-left corner of the page.

  2. In the navigation pane on the left, choose Dashboards. Navigate to the folder where you saved your dashboard and click the dashboard to open it.