MetricStore provides Prometheus-compatible query APIs. Add MetricStore as a Prometheus data source in Grafana to visualize time series data.
Prerequisites
-
Grafana is installed. Install Grafana.
-
Time series data is ingested into MetricStore. Ingest Prometheus monitoring data by using the Remote Write protocol.
Connect to Grafana
-
Log on to Grafana.
-
In the left-side navigation pane, choose .
-
On the Data Sources tab, click Add data source.
-
On the Prometheus card, click Select.
-
On the Settings tab, configure the following parameters.
Parameter
Description
Name
Custom name for the data source. Example: Prometheus-01.
HTTP
-
URL: MetricStore URL. Format:
https://{project}.{sls-endpoint}/prometheus/{project}/{metricstore}. {sls-endpoint}: the endpoint for your Project's region. Service Endpoints. {project} and {metricstore}: your Project and MetricStore names. Example:https://sls-prometheus-test.cn-hangzhou.log.aliyuncs.com/prometheus/sls-prometheus-test/prometheus.NoteUse
httpsfor secure data transmission. -
Whitelisted Cookies: Optional. Cookies to add to the whitelist.
Auth
Enable the Basic auth toggle.
Basic Auth Details
-
User: Your Alibaba Cloud account's AccessKey ID.
-
Password: Your Alibaba Cloud account's AccessKey secret.
We recommend that you use a RAM user with read-only permissions on the Project. Read-only policy for a specified Project.
-
-
Click Save & Test.
Import a dashboard
Log Service provides prebuilt dashboards in the Grafana marketplace.
-
Copy the dashboard ID.
-
Go to the Grafana Dashboards marketplace.
-
Click the dashboard that you want to import.
-
On the right side of the page, click Copy ID to Clipboard.
-
-
Log on to Grafana.
-
In the left-side navigation pane, choose .
-
In the Grafana.com Dashboard field, paste the dashboard ID that you copied in Step 1.
After you paste the ID, click outside the field to load the import options.
-
Configure the data source.
Select the data source from the Connect to Grafana section. Some dashboards may require additional variables such as
telegraforhost. -
Click Import.
Prometheus query APIs
Log Service supports the following Prometheus-compatible query APIs. Use them through the Grafana data source or call them directly.
|
API name |
Example |
|
|
|
|
|
|
|
|
|