Grafana
Grafana is an open-source platform for real-time metric visualization and data analysis. Metrics service fully supports integration with Grafana. The integration allows you to view 30-day historical metrics and build analytical queries for metrics.
To visualize metrics, configure Grafana.
Configure Grafana
1. Add a service user
Add a service user with permission in the Projects access area and the role:
metrics.admin;member;- or
reader.
Users can be added by the Account Owner or users with the iam.admin.
2. Start Grafana
This instruction is for running Grafana locally. If you already have a Grafana installation, start it using the Start the Grafana server guide in the official Grafana documentation.
-
Open the CLI.
-
Start Grafana in Docker.
docker run -d -p 3000:3000 --name=grafana grafana/grafana
-
Open the
http://localhost:3000page in your browser. -
To connect to Grafana, enter the default credentials: username (
admin) and password (admin).
3. Configure a data source
-
Go to the Data Sources.
-
Click Add data source.
-
Select Prometheus.
-
In the Name field, specify a name for the data source.
-
In the Connection block, in the Prometheus server URL field, enter the Metrics service endpoint:
<base_url>/projects/<project_id>/namespaces/<namespace>Specify:
<base_url>— API URL for the Metrics service. If you are configuring an agent to collect metrics for a dedicated server, use the cloud server pool URL that corresponds to the pool where your dedicated server is located. The list of URLs can be found in the URL list;<project_id>— Project ID. You can copy it in the control panel: in the top menu, click Products and select Cloud servers → open the projects menu → in the row of the required project, click ;<namespace>— the name of the selected namespace, for example,compute.
-
In the Authentication method field, select Basic authentication.
-
In the User field, enter the ID of the user you added in step 1;
-
In the Password field, enter the user password you added in step 1.
-
Click Save & test and wait for the test request to complete.
4. Create a dashboard
-
Go to the Dashboards section.
-
Click Create dashboard.
-
Click Add visualization.
-
Select the Prometheus data source that you configured in step 3.
-
On the Queries tab, in the Metrics field, enter the metric name. Learn more about available metrics in the Metrics reference.
-
Optional: to add multiple metrics, click Add query and repeat step 5.
-
To display metric values on the dashboard, click Run queries.
-
Click Save dashboard.