Setting Up YDB Cluster Monitoring
This page explains how to set up monitoring for a YDB cluster.
YDB provides numerous system state metrics. Instant metric values can be viewed in the web interface:
http://<ydb-server-address>:<ydb-port>/counters/
where:
-
<ydb-server-address>
– YDB server address.For a local single-node YDB cluster started using the Quick start instructions, use the address
localhost
. -
<ydb-port>
– YDB port. Default value: 8765.
Related metrics are grouped into subgroups (for example counters auth
). To view metric values for a specific subgroup only, navigate to a URL of the following form:
http://<ydb-server-address>:<ydb-port>/counters/counters=<servicename>/
<servicename>
— metric subgroup name.
For example, server hardware resource utilization data is available at the following URL:
http://<ydb-server-address>:<ydb-port>/counters/counters=utils
To collect metric values, you can use the popular open-source tool Prometheus or any other system that supports this format. YDB metric values in Prometheus format are available at URLs of the following form:
http://<ydb-server-address>:<ydb-port>/counters/counters=<servicename>/prometheus
<servicename>
— metric subgroup name.
Data can be visualized using any system that supports the Prometheus format, such as Grafana, Zabbix or Amazon CloudWatch:
Setting Up Monitoring with Prometheus and Grafana
To set up YDB cluster monitoring using Prometheus and Grafana:
-
Install Prometheus.
-
Edit the Prometheus configuration file:
-
In the
targets
section, specify the addresses of all YDB cluster servers and the ports of each storage node and database node running on the server.For example, for a cluster of three servers, where each server runs one storage node on port 8765 and two database nodes on ports 8766 and 8767, you need to specify nine addresses for all metric subgroups except disk metrics (for disk metric subgroups, you only need to specify storage node addresses):
static_configs: - targets: - ydb-s1.example.com:8765 - ydb-s1.example.com:8766 - ydb-s1.example.com:8767 - ydb-s2.example.com:8765 - ydb-s2.example.com:8766 - ydb-s2.example.com:8767 - ydb-s3.example.com:8765 - ydb-s3.example.com:8766 - ydb-s3.example.com:8767
For a local single-node YDB cluster, specify one address in the
targets
section:- targets: ["localhost:8765"]
-
If necessary, in the
tls_config
section, specify the Certificate Authority (CA) certificate that signed the other TLS certificates of the YDB cluster:scheme: https tls_config: ca_file: '<ydb-ca-file>'
-
-
Start Prometheus using the edited configuration file.
-
Install and start Grafana.
-
Create a data source with type
prometheus
in Grafana and connect it to the running Prometheus instance. -
Upload YDB dashboards to Grafana.
You can upload dashboards using the Grafana UI Import tool or run the script. Note that the script uses basic authentication in Grafana. For other cases, modify the script.
See the Grafana dashboards reference.