Connect your Managed Service for Prometheus instance to Managed Service for Grafana to query and visualize Prometheus metrics in Grafana dashboards.
To add a self-managed Prometheus data source instead, see:
Deployed on Alibaba Cloud:
Deployed in your own data center: Prometheus data source
Prerequisites
Before you begin, make sure that you have:
A Grafana workspace -- see Create a workspace
Data in your Managed Service for Prometheus instance
The endpoint URL of your Managed Service for Prometheus instance, available on the instance details page in the ARMS console
The Grafana administrator password you set when creating the workspace
Log on to Grafana
Log on to the Managed Service for Grafana console. In the left-side navigation pane, click Workspace Management.
On the Workspace Management page, find your workspace and click the URL in the URL column to open Grafana.
Log on with the Grafana administrator account, or click Sign in with Alibaba Cloud to use your Alibaba Cloud account.
Add a Managed Service for Prometheus data source
The navigation path differs slightly between Grafana versions. Follow the steps for your version.
Grafana 9.0.x
In the left-side navigation pane, choose
> Add data source.Search for and click Prometheus.
On the Settings tab, configure the following parameters.
Parameter Description Name A display name for this data source, such as ARMS-Prometheus.URL The endpoint URL of your Managed Service for Prometheus instance. To find this URL, open the ARMS console, go to Managed Service for Prometheus > Instances, and click the instance name. The endpoint URL is displayed on the instance details page. For other parameters, see Prometheus data source.
Click Save & test.
If the
Data source is workingmessage appears, the connection is successful.NoteIf the test fails, verify that:
The Prometheus endpoint URL is correct and uses the right protocol (HTTP or HTTPS).
The Grafana workspace can reach the Prometheus instance over the network. If they are in different VPCs, you may need to configure a VPC data channel.
Grafana 10.0.x
On the Grafana homepage, click the
icon.In the left-side navigation pane, choose Management > Data sources.
Click + Add new data source.
Search for and click Prometheus.
On the Settings tab, configure the following parameters.
Parameter Description Name A display name for this data source, such as ARMS-Prometheus.URL The endpoint URL of your Managed Service for Prometheus instance. To find this URL, open the ARMS console, go to Managed Service for Prometheus > Instances, and click the instance name. The endpoint URL is displayed on the instance details page. For other parameters, see Prometheus data source.
Click Save & test.
If the
Data source is workingmessage appears, the connection is successful.NoteIf the test fails, verify that:
The Prometheus endpoint URL is correct and uses the right protocol (HTTP or HTTPS).
The Grafana workspace can reach the Prometheus instance over the network. If they are in different VPCs, you may need to configure a VPC data channel.
Create a dashboard panel
With the data source connected, create a dashboard to visualize your Prometheus metrics.
Grafana 9.0.x
In the left-side navigation pane, choose
> New dashboard.Click Add a new panel.
On the Query tab of the Edit Panel page, select the Prometheus data source you added from the Data source drop-down list.
In the A section of the Query tab, configure Metric and Labels, then click Run queries.

In the right-side pane, set the panel title, visualization type, and graph style.
Click Apply.
In the upper-right corner, click the
icon. Enter a dashboard name and select a folder.Click Save.
Grafana 10.0.x
On the Grafana homepage, click the
icon.In the left-side navigation pane, click Dashboards. Select New dashboard from the New drop-down list.
Click + Add visualization.
In the Select data source dialog box, select the Prometheus data source you added.
In the A section of the Query tab, configure Metric and Labels, then click Run queries.

In the right-side pane, set the panel title, visualization type, and graph style.
Click Apply.
In the upper-right corner, click the
icon. Enter a dashboard name and select a folder.Click Save.
(Optional) Install Prometheus Node Exporter
To monitor ECS instance metrics such as CPU, memory, and disk usage, install Prometheus Node Exporter and connect it to your Prometheus instance.
Download Node Exporter
Download Node Exporter from the Prometheus official website, or run the following command:
wget https://github.com/prometheus/node_exporter/releases/download/v1.2.0/node_exporter-1.2.0.linux-amd64.tar.gzVerify that Node Exporter is running
Start Node Exporter, then verify that it is collecting metrics:
curl http://localhost:9100/metricsReplace
localhostand the port based on your deployment.To confirm that the metrics endpoint is reachable from other ECS instances, run
curl http://<ECS-IP>:9100/metricsfrom another instance. If the connection fails, check whether a security group rule is blocking port 9100.
Add the Node Exporter target for service discovery
Choose one of the following approaches based on how your Prometheus instance is deployed.
Managed Service for Prometheus
Log on to the ARMS console. In the left-side navigation pane, choose .
In the top navigation bar, select the region of your Prometheus instance. Click the instance name.
In the left-side navigation pane, click Settings. On the Settings tab, click Edit Prometheus.yaml and add the Node Exporter target IP address.
Self-managed Prometheus
Add the Node Exporter target to your prometheus.yml file:
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['<Node-Exporter-IP>:9100']Replace <Node-Exporter-IP> with the IP address of the ECS instance running Node Exporter.
(Optional) Import a Node Exporter dashboard template
Instead of building a dashboard from scratch, import a pre-built Grafana template to monitor Node Exporter metrics.
Grafana 9.0.x
In the left-side navigation pane, click the
icon.On the Browse tab, click Import.
In the Import via grafana.com input box, enter
12884and click Load.
Configure the import options.
Parameter Description Name A display name for the dashboard. Folder The folder to store the dashboard in. Unique identifier (UID) Click Change uid to customize the dashboard UID. Prometheus The Prometheus data source to use. 
Click Import.
In the upper-right corner, click the
icon and click Save.
Grafana 10.0.x
On the Grafana homepage, click the
icon.In the left-side navigation pane, click Dashboards. Click New in the upper-right corner, then select Import.
In the Import via grafana.com input box, enter
12884and click Load.
Configure the import options.
Parameter Description Name A display name for the dashboard. Folder The folder to store the dashboard in. Unique identifier (UID) Click Change uid to customize the dashboard UID. Prometheus The Prometheus data source to use. 
Click Import.
In the upper-right corner, click the
icon and click Save.