Grafana
Grafana is an open-source platform for real-time metric visualization and data analysis. The Metrics service supports full integration with Grafana. This integration allows you to view historical metrics for 30 days 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 is a guide for running Grafana locally. If you have a ready-to-use Grafana installation, run it using the instructions in Start the Grafana server 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>— the URL for accessing the Metrics service API. 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 Metrics subsection of the List of URLs;<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 line of the required project, click ;<namespace>— name of the selected namespace, for example,compute. You can find it in the Metrics Reference.
-
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 password of the user you added in step 1.
-
Click Save & test and wait for the test request to complete.
4. Create a dashboard
-
Go to the Dashboards.
-
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. For more details on available metrics, see 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.