---
title: "Monitoring a Kafka cluster"
sidebar_label: "Monitoring a cluster"
description: "How to track the status of a Kafka cluster, nodes, and databases, and how to export metrics in Prometheus format"
sidebar_position: 8
toc_max_heading_level: 3
---

import Formbricks from '@theme/MDXComponents/Formbricks';
import { CustomTable } from '@selectel/docux/components';
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import { TabItemLabel } from '@selectel/docux/components';
import CopyIcon from '@selectel/docux/icons/copy';

# Monitoring a Kafka cluster

In Kafka Managed Databases, you can track the status of the cluster.

To evaluate the overall status of the cluster, [view its status](#view-cluster-status).

For a more detailed analysis, you can:

* [view the status of cluster nodes](#view-cluster-node-status) — as charts in the control panel;
* [export cluster node metrics in Prometheus format](#export-metrics-in-prometheus-format).

When analyzing charts, note that the time in the Control Panel corresponds to the time on your device and does not depend on the region where the cluster is located.

:::note

For example, you have created a cluster in Tashkent, in the uz-1 pool. The device from which you logged in to the control panel is set to the Moscow time zone. The time on metrics charts will be displayed in the Moscow time zone.

:::

## View cluster status \{#view-cluster-status}

1. In the [control panel](https://my.selectel.ru/vpc/default/dbaas/), on the top menu click **Products** and select **Managed Databases**.

2. Open the **Active** tab.

3. View the status in the cluster row.

   <CustomTable>
     <table>
       <tbody>
         <tr>
           <th>ACTIVE</th><td>Cluster is available</td>
         </tr>

         <tr>
           <th>CREATING</th><td>Cluster is being created</td>
         </tr>

         <tr>
           <th>UPDATING</th><td>Cluster is being updated</td>
         </tr>

         <tr>
           <th>RESIZING</th><td>Cluster is scaling</td>
         </tr>

         <tr>
           <th>ERROR</th><td>An error occurred, [create a ticket](https://my.selectel.ru/tickets/create/)</td>
         </tr>

         <tr>
           <th>DISK FULL</th>

           <td>
             The disk is full, the cluster is in read-only mode. To switch the cluster to read-write mode, [free up disk space](/managed-databases/kafka/use-disk-space.mdx#free-up-disk-space) or [scale the cluster](/managed-databases/kafka/resize-cluster.mdx) and choose a configuration with a larger disk size
           </td>
         </tr>

         <tr>
           <th>DEGRADED</th><td>Some cluster nodes are unavailable</td>
         </tr>

         <tr>
           <th>DELETING</th><td>Cluster is being deleted</td>
         </tr>
       </tbody>
     </table>
   </CustomTable>

## View cluster node status \{#view-cluster-node-status}

1. In the [control panel](https://my.selectel.ru/vpc/default/dbaas/), on the top menu click **Products** and select **Managed Databases**.
2. Open the **Active** tab.
3. Open the cluster page → **Monitoring** tab.
4. In the **Cluster monitoring** block, view the available [cluster node metrics](#cluster-node-metrics).

### Cluster node metrics in the control panel \{#cluster-node-metrics}

<CustomTable>
  <table data-sticky>
    <tbody>
      <tr>
        <th>Memory</th><td>Memory used excluding operating system cache and buffers, in percent or gigabytes</td>
      </tr>

      <tr>
        <th>vCPU</th><td>Percentage of cluster node core utilization</td>
      </tr>

      <tr>
        <th>CPU iowait</th><td>Percentage of time the processor spent waiting for I/O operations</td>
      </tr>

      <tr>
        <th>Disk</th>

        <td>
          Occupied disk space in percentages or gigabytes. Accounts for the portion of disk space reserved for service needs and not available for database placement. For more information about disk space reservation, see the [Using disk space in a Kafka cluster](/managed-databases/kafka/use-disk-space.mdx) guide
        </td>
      </tr>

      <tr>
        <th>Load Average</th>

        <td>
          Average system load over a period of time. Shows the number of processes being handled by cluster cores. The indicator is presented as three values – for one, five, and 15 minutes. These values should not exceed the number of cores on the node
        </td>
      </tr>

      <tr>
        <th>OOM</th>

        <td>
          number of processes that finished with an `Out of Memory` error due to lack of RAM
        </td>
      </tr>

      <tr>
        <th>Disk load</th>

        <td>
          Read and write speed in KB/s or number of read/write operations per second
        </td>
      </tr>

      <tr>
        <th>Network load</th><td>Number of bits or packets sent and received via the network interface</td>
      </tr>
    </tbody>
  </table>
</CustomTable>

## Export metrics in Prometheus format \{#export-metrics-in-prometheus-format}

Historical information for clusters is not available – metrics are requested only in real time. A list of all metrics supported in Managed Databases and their descriptions can be viewed in the [Metrics in Prometheus format](#metrics-in-prometheus-format) table.

1. [Get a token](#get-token).
2. [Get metrics in Prometheus format](#get-prometheus-metrics).

### 1. Get a token \{#get-token}

The token provides access to metrics for all clusters in a [project](/access-control/projects/about-projects.mdx) in a single [pool](/infrastructure/locations.mdx#pool).

1. In the [control panel](https://my.selectel.ru/vpc/default/dbaas/), on the top menu click **Products** and select **Managed Databases**.

2. Open the **Active** tab.

3. Open the cluster page → **Monitoring** tab.

4. In the **Prometheus tokens** block, click **Create token**. The token will be generated automatically.

5. Copy the token. To do this, in the token row, click <CopyIcon />.

### 2. Get metrics in Prometheus format \{#get-prometheus-metrics}

<Tabs queryString="get-prometheus-metrics">
  <TabItem value="config" default>
    <TabItemLabel>
      Configuration file
    </TabItemLabel>

    1. Add to the Prometheus configuration file:

       ```yaml
       scrape_configs:
         - job_name: get-metrics-from-dbaas
           scrape_interval: 1m
           static_configs:
             - targets:
               - '<domain>'
           scheme: https
           authorization:
             type: Bearer
             credentials: <token>
       ```

       Specify:

       * `<domain>` is the Managed Databases API domain. This is the part of the URL used to access the API without `https://` and `/v1`, for example  `ru-3.dbaas.selcloud.ru`. The URL depends on the [region and pool](/infrastructure/locations.mdx#selectel-infrastructure) and can be viewed in the [list of URLs](/api/urls/);
       * `<token>` — the token you copied when [getting the token](#get-token) in step 5.

    2. Open the page in your browser where Prometheus-format metrics will be available:

       ```bash
       http://<ip_address>:9090/targets
       ```

       Specify `<ip_address>` — the IP address where Prometheus is installed.

    3. Set up monitoring and alerts for database clusters yourself.
  </TabItem>

  <TabItem value="cli">
    <TabItemLabel>
      CLI
    </TabItemLabel>

    1. Open the CLI.

    2. To get metrics, send a request:

       ```bash
       curl -L "https://<domain>/metrics" -H "Authorization: Bearer <token>"
       ```

       Specify:

       * `<domain>` is the Managed Databases API domain. This is the part of the URL used to access the API without `https://` and `/v1`, for example  `ru-3.dbaas.selcloud.ru`. The URL depends on the [region and pool](/infrastructure/locations.mdx#selectel-infrastructure) and can be viewed in the [list of URLs](/api/urls/);
       * `<token>` — the token you copied when [getting the token](#get-token) in step 5.

       The available metrics in Prometheus format will appear in the response.

    3. Set up monitoring and alerts for database clusters yourself.
  </TabItem>
</Tabs>

### Metrics in Prometheus format \{#metrics-in-prometheus-format}

metrics in Prometheus format are provided for all clusters. A specific cluster can be found by its database cluster ID in the `ds_id` label.

<CustomTable>
  <table data-sticky>
    <tbody>
      <tr>
        <th>dbaas\_memory\_percent</th><td>Memory used excluding operating system cache and buffers (RAM), in percent</td>
      </tr>

      <tr>
        <th>dbaas\_memory\_bytes</th><td>Memory used excluding operating system cache and buffers (RAM), in bytes</td>
      </tr>

      <tr>
        <th>dbaas\_oom\_count</th><td>number of processes that finished with an `Out of Memory` error due to lack of RAM</td>
      </tr>

      <tr>
        <th>dbaas\_cpu</th><td>vCPU usage on database cluster nodes, in percent</td>
      </tr>

      <tr>
        <th>dbaas\_cpu\_iowait</th><td>I/O wait time, in percent</td>
      </tr>

      <tr>
        <th>dbaas\_disk\_percent</th>

        <td>
          Occupied disk space in percentages. Accounts for the portion of disk space reserved for service needs and not available for database placement. For more information about disk space reservation, see the [Using disk space in a Kafka cluster](/managed-databases/kafka/use-disk-space.mdx) guide
        </td>
      </tr>

      <tr>
        <th>dbaas\_disk\_bytes</th>

        <td>
          Occupied disk space in bytes. Accounts for the portion of disk space reserved for service needs and not available for database placement. For more information about disk space reservation, see the [Using disk space in a Kafka cluster](/managed-databases/kafka/use-disk-space.mdx) guide
        </td>
      </tr>

      <tr>
        <th>dbaas\_disk\_read\_iops</th><td>Number of read operations per second</td>
      </tr>

      <tr>
        <th>dbaas\_disk\_write\_iops</th><td>Number of write operations per second</td>
      </tr>

      <tr>
        <th>dbaas\_disk\_read\_bytes</th><td>Disk read speed, in bytes per second</td>
      </tr>

      <tr>
        <th>dbaas\_disk\_write\_bytes</th><td>Disk write speed, in bytes per second</td>
      </tr>

      <tr>
        <th>dbaas\_node\_load1</th><td>Average system load over one minute. Shows how many processes are being handled by cluster cores</td>
      </tr>

      <tr>
        <th>dbaas\_node\_load5</th><td>Average system load over five minutes. Shows how many processes are being handled by cluster cores</td>
      </tr>

      <tr>
        <th>dbaas\_node\_load15</th><td>Average system load over 15 minutes. Shows how many processes are being handled by cluster cores</td>
      </tr>

      <tr>
        <th>dbaas\_network\_receive\_bytes</th><td>Number of bytes received via the network interface</td>
      </tr>

      <tr>
        <th>dbaas\_network\_transmit\_bytes</th><td>Number of bytes sent via the network interface</td>
      </tr>

      <tr>
        <th>dbaas\_network\_receive\_packets</th><td>Number of packets received via the network interface per second</td>
      </tr>

      <tr>
        <th>dbaas\_network\_transmit\_packets</th><td>Number of packets sent via the network interface per second</td>
      </tr>

      <tr>
        <th>dbaas\_role</th>

        <td>
          Node role:

          <ul>
            <li>`0` — role unknown; ;</li><li>`1` — master; ;</li><li>`2` — replica</li>
          </ul>
        </td>
      </tr>
    </tbody>
  </table>
</CustomTable>

<Formbricks />
