---
title: "Monitoring a Redis cluster, nodes, and databases"
sidebar_label: "Monitoring a cluster, nodes, and databases"
sidebar_position: 7
description: "How to monitor the state of a Redis cluster, nodes, and databases, and how to export metrics in Prometheus format"
---

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 Redis cluster, nodes, and databases

In Redis Managed Databases, you can monitor the cluster state.

To assess the general state of the cluster, [check 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;
* [view the status of databases](#view-database-state) — as charts in the control panel;
* [export cluster node and database metrics in Prometheus format](#export-metrics-in-prometheus-format).

When analyzing charts, keep in mind 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. On the device from which you logged into the control panel, the Moscow time zone is set. The time on the 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/) top menu, click **Products** and select **Managed Databases**.
2. Open the **Active** tab.
3. In the cluster row, check the status.

   <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 updating</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>
             Disk is full; the cluster is read-only. To make the cluster read and write, [scale the cluster](/managed-databases/redis/resize-cluster.mdx) and select 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/) 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, click **Cluster nodes**.
5. Select the nodes for which you want to view metrics.
6. 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>Used memory excluding OS cache and buffers, in percent or gigabytes</td>
      </tr>

      <tr>
        <th>vCPU</th><td>vCPU usage of cluster nodes in percent</td>
      </tr>

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

      <tr>
        <th>Disk</th>

        <td>
          Occupied disk space in percent or gigabytes. It takes into account the part of the disk space reserved for system needs and unavailable for database placement. For more information about reserving disk space, see the [Using disk space in a Redis cluster](/managed-databases/redis/use-disk-space.mdx) instructions
        </td>
      </tr>

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

        <td>
          Average system load over a period of time. It shows the number of processes being processed by the cluster cores. The metric is presented as three values — for one minute, five minutes, and 15 minutes. These values should not be greater than the number of cores on the node
        </td>
      </tr>

      <tr>
        <th>OOM</th>

        <td>
          Number of processes that terminated with an `Out of Memory` error due to insufficient RAM
        </td>
      </tr>

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

        <td>
          Read and write speed in KB/s or the number of read and 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>

## View database status \{#view-database-state}

1. In the [control panel](https://my.selectel.ru/vpc/default/dbaas/) 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, click **Databases**.
5. Select the nodes for which you want to view metrics.
6. View the available [database metrics](#database-metrics).

### Database metrics in the control panel \{#database-metrics}

<CustomTable>
  <table>
    <tbody>
      <tr>
        <th>Evicted and expired keys</th>

        <td>
          Two parameters are displayed:

          <ul>
            <li>`Evicted` — number of keys evicted due to memory limit exceeded;</li><li>`Expired` — number of expired keys</li>
          </ul>
        </td>
      </tr>

      <tr>
        <th>Number of keys</th><td>Number of keys in all databases and number of keys with a defined time-to-live (TTL)</td>
      </tr>

      <tr>
        <th>Connections</th><td>Number of connections to cluster databases</td>
      </tr>

      <tr>
        <th>Slow queries</th>

        <td>
          Number of slow queries per second. Queries that take longer than 0.01 seconds are considered slow
        </td>
      </tr>

      <tr>
        <th>Queries</th>

        <td>
          Number of successful and failed queries per second. Failed queries are those for which the key does not exist, was evicted due to memory limits, or its time-to-live (TTL) has expired
        </td>
      </tr>
    </tbody>
  </table>
</CustomTable>

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

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 of a [project](/access-control/projects/about-projects.mdx) in one [pool](/infrastructure/locations.mdx#pool).

1. In the [control panel](https://my.selectel.ru/vpc/default/dbaas/) 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 line, click .<CopyIcon />

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

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

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

    1. Add the following 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>` — Managed Databases API domain. This is a 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 found in the [list of URLs](/api/urls/);
       * `<token>` — the token you copied when [obtaining the token](#get-token) in step 5.

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

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

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

    3. Configure 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>` — Managed Databases API domain. This is a 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 found in the [list of URLs](/api/urls/);
       * `<token>` — the token you copied when [obtaining the token](#get-token) in step 5.

       The response will contain the available metrics in Prometheus format.

    3. Configure 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 the database cluster ID in the `ds_id` label.

<Tabs queryString="metrics-in-prometheus-format">
  <TabItem value="infrastructure" default>
    <TabItemLabel>
      Infrastructure-level metrics
    </TabItemLabel>

    <CustomTable>
      <table data-sticky>
        <tbody>
          <tr>
            <th>dbaas\_memory\_percent</th><td>Used memory excluding OS cache and buffers (RAM) in percent</td>
          </tr>

          <tr>
            <th>dbaas\_memory\_bytes</th><td>Used memory excluding OS cache and buffers (RAM) in bytes</td>
          </tr>

          <tr>
            <th>dbaas\_oom\_count</th><td>Number of processes that failed with an `Out of Memory` error due to insufficient 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 percent. It takes into account the part of disk space reserved for service needs and unavailable for database placement. For more information about reserving disk space, see the instructions [Using disk space in a Redis cluster](/managed-databases/redis/use-disk-space.mdx)
            </td>
          </tr>

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

            <td>
              Occupied disk space in bytes. It takes into account the part of disk space reserved for service needs and unavailable for database placement. For more information about reserving disk space, see the instructions [Using disk space in a Redis cluster](/managed-databases/redis/use-disk-space.mdx)
            </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 processed by cluster cores</td>
          </tr>

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

          <tr>
            <th>dbaas\_node\_load15</th><td>Average system load over 15 minutes. Shows how many processes are being processed 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>
  </TabItem>

  <TabItem value="application">
    <TabItemLabel>
      Application-level metrics
    </TabItemLabel>

    <CustomTable>
      <table data-sticky>
        <tbody>
          <tr>
            <th>dbaas\_connected\_clients</th><td>Number of connections to cluster databases</td>
          </tr>

          <tr>
            <th>dbaas\_keyspace\_hits\_total</th><td>Number of successful requests per second</td>
          </tr>

          <tr>
            <th>dbaas\_keyspace\_misses\_total</th><td>Number of failed requests per second. Requests are considered failed if they indicate that the key does not exist, was evicted due to memory limit exceeded, or its TTL has expired</td>
          </tr>

          <tr>
            <th>dbaas\_db\_keys</th><td>Total number of keys in all databases</td>
          </tr>

          <tr>
            <th>dbaas\_db\_keys\_expiring</th><td>Total number of expired keys</td>
          </tr>

          <tr>
            <th>dbaas\_evicted\_keys\_total</th><td>Number of keys evicted due to memory limit exceeded</td>
          </tr>

          <tr>
            <th>dbaas\_expired\_keys\_total</th><td>Number of keys with an expired time-to-live</td>
          </tr>

          <tr>
            <th>dbaas\_slowlog\_length</th><td>Number of slow queries per second. Queries taking longer than 0.01 seconds are considered slow</td>
          </tr>
        </tbody>
      </table>
    </CustomTable>
  </TabItem>
</Tabs>

<Formbricks />
