Skip to content

Commit

Permalink
Merge a1c59db into dcb89a5
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-bobkov authored Jan 31, 2025
2 parents dcb89a5 + a1c59db commit 49e6d1f
Show file tree
Hide file tree
Showing 2 changed files with 124 additions and 33 deletions.
84 changes: 64 additions & 20 deletions ydb/docs/en/core/devops/manual/monitoring.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,91 @@
# Setting up monitoring for a local {{ ydb-short-name }} cluster
# Setting up monitoring for a {{ ydb-short-name }} cluster

This page provides instructions on how to set up monitoring for a local {{ ydb-short-name }} cluster that is deployed using [Quick start](../../quickstart.md).
This page provides instructions on how to set up monitoring for a {{ ydb-short-name }} cluster.

{{ ydb-short-name }} has multiple system health sensors. Instant sensor values are available in the web interface:

```http
http://localhost:31002/counters/
http://<ydb-server-address>:<ydb-port>/counters/
```

Linked sensors are grouped into a subgroup (such as `counters auth`). To only view sensor values for a particular subgroup, follow a URL like:
- `<ydb-server-address>`: {{ ydb-short-name }} server address.

For a local {{ ydb-short-name }} cluster that is deployed using [Quick start](../../quickstart.md) use the `localhost` address.

- `<ydb-port>`: {{ ydb-short-name }} port. Default value: 8765.

Linked sensors are grouped into subgroups (such as `counters auth`). To only view sensor values for a particular subgroup, follow a URL like:

```http
http://localhost:31002/counters/counters=<servicename>/
http://<ydb-server-address>:<ydb-port>/counters/counters=<servicename>/
```

* `<servicename>`: Sensor subgroup name.
- `<servicename>`: sensor subgroup name.

> For example, data about the utilization of server hardware resources is available at the URL:
>
> ```http
> http://localhost:31002/counters/counters=utils
> ```
For example, data about the utilization of server hardware resources is available at the URL:

You can collect metric values using [Prometheus](https://prometheus.io/), a popular open-source tool. {{ ydb-short-name }} sensor values in [Prometheus format](https://prometheus.io/docs/instrumenting/exposition_formats/) are available at a URL in the following format:
```http
http://<ydb-server-address>:<ydb-port>/counters/counters=utils
```

You can collect metric values using [Prometheus](https://prometheus.io/), a popular open-source observability tool, or any other system compatible with its format. {{ ydb-short-name }} sensor values in [Prometheus format](https://prometheus.io/docs/instrumenting/exposition_formats/) are available at a URL in the following format:

```http
http://localhost:31002/counters/counters=<servicename>/prometheus
http://<ydb-server-address>:<ydb-port>/counters/counters=<servicename>/prometheus
```

* `<servicename>`: Sensor subgroup name.
- `<servicename>`: sensor subgroup name.

To visualize data, use any system that supports Prometheus, such as [Zabbix](https://www.zabbix.com/), [Amazon CloudWatch](https://aws.amazon.com/cloudwatch/), or [Grafana](https://grafana.com/):
To visualize data, use any system that supports Prometheus, such as [Grafana](https://grafana.com/), [Zabbix](https://www.zabbix.com/), or [AWS CloudWatch](https://aws.amazon.com/cloudwatch/):

![grafana-actors](../../_assets/grafana-actors.png)

## Setting up monitoring with Prometheus and Grafana {#prometheus-grafana}

To set up monitoring for a local single-node {{ ydb-short-name }} cluster using [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/):
To set up monitoring for a {{ ydb-short-name }} cluster using [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/):

1. [Install](https://prometheus.io/docs/prometheus/latest/getting_started) Prometheus.

1. Edit the Prometheus [configuration file](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/grafana_dashboards/local_ydb_prometheus.yml):

1. In the `targets` section specify addresses of all servers of the {{ ydb-short-name }} cluster and ports for each storage and database node that runs on the server.

For example, for the {{ ydb-short-name }} cluster that contains three servers, each server running one storage node on port 8765 and two database nodes on ports 8766 and 8767, specify nine addresses for all sensor subgroups except for the disk subgroups (for disk sensor subgroups, specify only storage node addresses):

```json
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-short-name }} cluster, specify one address in the `targets` section:

```json
- targets: ["localhost:8765"]
```

1. If necessary, in the `tls_config` section, specify the [CA-issued certificate](./initial-deployment.md#tls-certificates) used to sign the other TLS certificates of the {{ ydb-short-name }} cluster:

```json
tls_config:
ca_file: '<ydb-ca-file>'
```

1. [Run](https://prometheus.io/docs/prometheus/latest/getting_started/#starting-prometheus) Prometheus using the edited configuration file.

1. [Install and start](https://grafana.com/docs/grafana/latest/getting-started/getting-started/) Grafana.

1. [Create](https://prometheus.io/docs/visualization/grafana/#creating-a-prometheus-data-source) a data source of the `prometheus` type in Grafana, and attach it to the running Prometheus instance.

1. [Install and run](https://prometheus.io/docs/prometheus/latest/getting_started/#downloading-and-running-prometheus) Prometheus via a [configuration file](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/grafana_dashboards/local_ydb_prometheus.yml).
1. [Install and start](https://grafana.com/docs/grafana/latest/getting-started/getting-started/) the Grafana.
1. [Create](https://prometheus.io/docs/visualization/grafana/#creating-a-prometheus-data-source) a data source of the `prometheus` type in Grafana and attach it to a running Prometheus instance.
1. Upload [{{ ydb-short-name }} dashboards](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/grafana_dashboards/) to Grafana.
1. Upload [{{ ydb-short-name }} dashboards](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/helm/ydb-prometheus/dashboards) to Grafana.

To upload dashboards, use the Grafana UI [Import](https://grafana.com/docs/grafana/latest/dashboards/export-import/#import-dashboard) tool or run a [script](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/grafana_dashboards/local_upload_dashboards.sh). Please note that the script uses [basic authentication](https://grafana.com/docs/grafana/latest/http_api/create-api-tokens-for-org/#authentication) in Grafana. For other cases, modify the script.

Expand Down
73 changes: 60 additions & 13 deletions ydb/docs/ru/core/devops/manual/monitoring.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,94 @@
# Настройка мониторинга локального кластера {{ ydb-short-name }}
# Настройка мониторинга кластера {{ ydb-short-name }}

На этой странице рассказано, как настроить мониторинг локального однонодового кластера YDB, запущенного с помощью инструкции по [Быстрому началу работы](../../quickstart.md).
На этой странице рассказано, как настроить мониторинг кластера {{ ydb-short-name }}.

{{ ydb-short-name }} предоставляет множество сенсоров состояния системы. Мгновенные значения сенсоров можно посмотреть в веб-интерфейсе:

```text
http://localhost:31002/counters/
http://<ydb-server-address>:<ydb-port>/counters/
```

где:

- `<ydb-server-address>` – адрес сервера {{ ydb-short-name }}.

Для локального однонодового кластера {{ ydb-short-name }}, запущенного с помощью инструкции по [Быстрому началу работы](../../quickstart.md), используйте адрес `localhost`.

- `<ydb-port>` – порт {{ ydb-short-name }}. Значение по умолчанию: 8765.

Связанные сенсоры объединены в подгруппы (например `counters auth`). Чтобы посмотреть значения сенсоров только определенной подгруппы, перейдите по URL следующего вида:

```text
http://localhost:31002/counters/counters=<servicename>/
http://<ydb-server-address>:<ydb-port>/counters/counters=<servicename>/
```

* `<servicename>` — имя подгруппы сенсоров.
- `<servicename>` — имя подгруппы сенсоров.

Например, данные об утилизации аппаратных ресурсов сервера доступны по следующему URL:

```text
http://localhost:31002/counters/counters=utils
http://<ydb-server-address>:<ydb-port>/counters/counters=utils
```

Для сбора значений метрик вы можете использовать популярный инструмент с открытым исходным кодом [Prometheus](https://prometheus.io/). Значения сенсоров {{ ydb-short-name }} в [формате Prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/) доступны по URL следующего вида:
Для сбора значений метрик вы можете использовать популярный инструмент с открытым исходным кодом [Prometheus](https://prometheus.io/) или любую другую систему с поддержкой этого формата. Значения сенсоров {{ ydb-short-name }} в [формате Prometheus](https://prometheus.io/docs/instrumenting/exposition_formats/) доступны по URL следующего вида:

```text
http://localhost:31002/counters/counters=<servicename>/prometheus
http://<ydb-server-address>:<ydb-port>/counters/counters=<servicename>/prometheus
```

* `<servicename>` — имя подгруппы сенсоров.
- `<servicename>` — имя подгруппы сенсоров.

Визуализировать данные можно с помощью любой системы, которая поддерживает формат Prometheus, например [Zabbix](https://www.zabbix.com/ru/), [Amazon CloudWatch](https://aws.amazon.com/ru/cloudwatch/) или [Grafana](https://grafana.com/):
Визуализировать данные можно с помощью любой системы, которая поддерживает формат Prometheus, например [Grafana](https://grafana.com/), [Zabbix](https://www.zabbix.com/ru/) или [Amazon CloudWatch](https://aws.amazon.com/ru/cloudwatch/):

![grafana-actors](../../_assets/grafana-actors.png)

## Настройка мониторинга с помощью Prometheus и Grafana {#prometheus-grafana}

Чтобы настроить мониторинг локального однонодового кластера {{ ydb-short-name }} с помощью [Prometheus](https://prometheus.io/) и [Grafana](https://grafana.com/):
Чтобы настроить мониторинг кластера {{ ydb-short-name }} с помощью [Prometheus](https://prometheus.io/) и [Grafana](https://grafana.com/):

1. [Установите](https://prometheus.io/docs/prometheus/latest/getting_started) Prometheus.

1. Отредактируйте [файл конфигурации](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/grafana_dashboards/local_ydb_prometheus.yml) Prometheus:

1. В секции `targets` укажите адреса всех серверов кластера {{ ydb-short-name }} и порты каждого из узлов хранения и узлов базы данных, работающих на сервере.

Например, для кластера из трёх серверов, где на каждом сервере работает один узел хранения на порте 8765 и два узла базы данных на портах 8766 и 8767, необходимо прописать девять адресов для всех подгрупп сенсоров, кроме дисковых (для дисковых подгрупп сенсоров необходимо указать только адреса узлов хранения):

```json
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
```

Для локального однонодового кластера YDB, в секции `targets` прописывается один адрес:

```json
- targets: ["localhost:8765"]
```

1. При необходимости, в секции `tls_config` укажите [сертификат центра регистрации](./initial-deployment.md#tls-certificates) (Certification Authority, CA), которым подписаны остальные сертификаты TLS кластера {{ ydb-short-name }}:

```json
scheme: https
tls_config:
ca_file: '<ydb-ca-file>'
```

1. [Запустите](https://prometheus.io/docs/prometheus/latest/getting_started/#starting-prometheus) Prometheus, используя отредактированный файл конфигурации.

1. [Установите и запустите](https://prometheus.io/docs/prometheus/latest/getting_started/#downloading-and-running-prometheus) Prometheus, используя [файл конфигурации](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/grafana_dashboards/local_ydb_prometheus.yml).
1. [Установите и запустите](https://grafana.com/docs/grafana/latest/getting-started/getting-started/) Grafana.

1. [Создайте](https://prometheus.io/docs/visualization/grafana/#creating-a-prometheus-data-source) источник данных с типом `prometheus` в Grafana и подсоедините его к запущенному экземпляру Prometheus.
1. Загрузите [дашборды {{ ydb-short-name }}](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/grafana_dashboards/) в Grafana.

1. Загрузите [дашборды {{ ydb-short-name }}](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/helm/ydb-prometheus/dashboards) в Grafana.

Вы можете загрузить дашборды с помощью инструмента [Import](https://grafana.com/docs/grafana/latest/dashboards/export-import/#import-dashboard) Grafana UI или выполнить [скрипт](https://github.com/ydb-platform/ydb/tree/main/ydb/deploy/grafana_dashboards/local_upload_dashboards.sh). Обратите внимание, что скрипт использует [базовую аутентификацию](https://grafana.com/docs/grafana/latest/http_api/create-api-tokens-for-org/#authentication) в Grafana. Для других случаев модифицируйте скрипт.

Expand Down

0 comments on commit 49e6d1f

Please sign in to comment.