---
title: "Monitoring of PostgreSQL cluster, nodes, and databases for 1C"
sidebar_label: "Monitoring of cluster, nodes, and databases"
sidebar_position: 9
description: "How to monitor the status of PostgreSQL cluster nodes, databases for 1C, 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 of PostgreSQL cluster, nodes, and databases for 1C

In managed PostgreSQL databases for 1C, you can monitor the cluster status.

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

For more detailed analysis, some metrics can be viewed as charts in the control panel:

* [cluster node metrics](#view-cluster-node-status);
* [database metrics](#view-database-state);
* [connection pooler metrics](#view-pooler-state).

A full set of available metrics can be [exported in Prometheus format](#export-metrics-in-prometheus-format).

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

<CustomTable>
  <table>
    <tbody>
      <tr>
        <th>ACTIVE</th><td>Cluster is active</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>
          The disk is full, the cluster is in read-only mode. To make the cluster work in read and write mode, [clean up the disk](/managed-databases/postgresql-for-1c/use-disk-space.mdx#disk-cleanup) or [scale the cluster](/managed-databases/postgresql-for-1c/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, click **Cluster nodes**.
5. Select the nodes for which you want to view metrics.
6. View 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>Occupied memory excluding operating system cache and buffers, in percent or gigabytes</td>
      </tr>

      <tr>
        <th>vCPU</th><td>Percentage of cluster node cores load</td>
      </tr>

      <tr>
        <th>CPU iowait</th><td>Percentage of time the processor spent waiting for input/output</td>
      </tr>

      <tr>
        <th>Volume</th>

        <td>
          Occupied disk space in percent or gigabytes. It takes into account the portion of disk space reserved for service needs and unavailable for database placement. For more information about reserving disk space, see the guide [Using disk space in a PostgreSQL cluster for 1C](/managed-databases/postgresql-for-1c/use-disk-space.mdx)
        </td>
      </tr>

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

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

      <tr>
        <th>OOM</th>

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

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

        <td>
          Read and write data speed in KB/s or 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/), 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, click **Databases**.
5. Select the nodes for which you want to view metrics.
6. View available [database metrics](#database-metrics).

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

<CustomTable>
  <table data-sticky>
    <tbody>
      <tr>
        <th>Statistics file size</th><td>Total size of the statistics file in kilobytes</td>
      </tr>

      <tr>
        <th>Cache hit</th><td>Percentage of data in the request read from the cache — the ratio of `blks_hit` to the sum of `blks_hit` and `blks_read`</td>
      </tr>

      <tr>
        <th>Row operations</th>

        <td>
          Number of rows affected by operations in the selected database per second:

          <ul>
            <li>`tup_deleted` — number of rows deleted by operations per second; ;</li><li>`tup_fetched` — number of rows retrieved by operations per second; ;</li><li>`tup_inserted` — number of rows inserted by operations per second; ;</li><li>`tup_returned` — number of rows returned by operations per second; ;</li><li>`tup_updated` — number of rows updated by operations per second </li>
          </ul>
        </td>
      </tr>

      <tr>
        <th>Locks</th><td>Number of locks in each cluster database</td>
      </tr>

      <tr>
        <th>Deadlocks</th><td>Number of deadlocks in each database</td>
      </tr>

      <tr>
        <th>Transactions</th><td>Number of transactions per second in each cluster database</td>
      </tr>

      <tr>
        <th>Connections</th><td>Number of connections to each cluster database and total number of connections to all databases</td>
      </tr>

      <tr>
        <th>Temporary file size</th><td>Total size of temporary files in kilobytes</td>
      </tr>

      <tr>
        <th>WAL file size</th><td>Total size of WAL files in megabytes</td>
      </tr>

      <tr>
        <th>Duration of the longest request</th><td>Duration of the longest request in each cluster database for a time period</td>
      </tr>

      <tr>
        <th>Database size</th><td>Total size of the selected database in megabytes</td>
      </tr>
    </tbody>
  </table>
</CustomTable>

## View connection pooler status \{#view-pooler-state}

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, click **Connection pooler**.
5. Select the nodes for which you want to view metrics.
6. View available [connection pooler metrics](#pooler-metrics).

### Connection pooler metrics in the control panel \{#pooler-metrics}

<CustomTable>
  <table data-sticky>
    <tbody>
      <tr>
        <th>Maximum client wait time in queue</th><td>Maximum client wait time in queue in the selected database in seconds</td>
      </tr>

      <tr>
        <th>Response wait time from server</th><td>Wait time for a response from the node in the selected database in seconds</td>
      </tr>

      <tr>
        <th>Active connections to the server</th><td>Number of server connections associated with clients, in the selected database</td>
      </tr>

      <tr>
        <th>Client connections to the pool</th>

        <td>
          Number of client connections to the pool in the selected database:

          <ul>
            <li>`pools_client_active_connections` — number of client connections associated with server connections or idle without requests; ;</li><li>`pools_client_waiting_connections` — number of client connections where the request has been sent, but there is no connection to the node yet </li>
          </ul>
        </td>
      </tr>
    </tbody>
  </table>
</CustomTable>

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

Historical information is not available for clusters; 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 [project](/access-control/projects/about-projects.mdx) clusters in one [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 **Tokens for Prometheus** block, click **Create Token**. The token will be generated automatically.

5. Copy the token. To do this, click the icon in the token line.<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 for accessing 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>` is the token you copied when [obtaining the token](#get-token) in step 5.

    2. Open the page in your browser where metrics in Prometheus format 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 for accessing 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>` is the token you copied when [obtaining the token](#get-token) in step 5.

       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}

метрики in формате Prometheus предоставляются для всех кластеров. конкретный кластер можно найти по идентификатору кластера базы данных in лейбле `ds_id`.

<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>Occupied memory excluding operating system cache and buffers (RAM) in percent</td>
          </tr>

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

          <tr>
            <th>dbaas\_oom\_count</th><td>количество процессов, которые завершились ошибкой `Out of Memory` из-за нехватки оперативной памяти</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>Input/output 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 disk space reservation, see the instructions [Using disk space in a PostgreSQL cluster for 1C](/managed-databases/postgresql-for-1c/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 disk space reservation, see the instructions [Using disk space in a PostgreSQL cluster for 1C](/managed-databases/postgresql-for-1c/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 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 is 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\_connections</th>

            <td>
              Number of active connections to the PostgreSQL process <br />For example, you can use the following labels:

              <ul>
                <li>`ds_name` — database cluster name;</li><li>`datname` — database name.</li>
              </ul>
            </td>
          </tr>

          <tr>
            <th>dbaas\_total\_connections</th><td>Total number of established connections to the PostgreSQL process</td>
          </tr>

          <tr>
            <th>dbaas\_max\_tx\_duration</th><td>Duration of the longest request in seconds</td>
          </tr>

          <tr>
            <th>dbaas\_xact\_commit\_rollback</th>

            <td>
              Number of transactions per second in each cluster database. <br />For example, you can use the following labels:

              <ul>
                <li>`ds_name` — database cluster name;</li><li>`datname` — database name.</li>
              </ul>
            </td>
          </tr>

          <tr>
            <th>dbaas\_tup\_deleted</th><td>Number of rows per second deleted by queries in the database</td>
          </tr>

          <tr>
            <th>dbaas\_tup\_fetched</th><td>Number of rows per second retrieved by queries in the database</td>
          </tr>

          <tr>
            <th>dbaas\_tup\_inserted</th><td>Number of rows per second inserted by queries in the database</td>
          </tr>

          <tr>
            <th>dbaas\_tup\_returned</th><td>Number of rows per second returned by queries in the database</td>
          </tr>

          <tr>
            <th>dbaas\_tup\_updated</th><td>Number of rows per second modified by queries in the database</td>
          </tr>

          <tr>
            <th>dbaas\_xact\_commit</th><td>Number of committed transactions per second in the database</td>
          </tr>

          <tr>
            <th>dbaas\_xact\_rollback</th><td>Number of transactions per second in the database for which a rollback was performed</td>
          </tr>

          <tr>
            <th>dbaas\_cache\_hit\_ratio</th><td>Percentage of data in the query read from the cache — the ratio of `blks_hit` to the sum of `blks_hit` and `blks_read`</td>
          </tr>

          <tr>
            <th>dbaas\_deadlocks</th>

            <td>
              Number of deadlocks per second in each database. <br />For example, you can use the following labels:

              <ul>
                <li>`ds_name` — database cluster name;</li><li>`datname` — database name.</li>
              </ul>
            </td>
          </tr>

          <tr>
            <th>dbaas\_locks</th>

            <td>
              Number of locks per second in each database of the cluster. For example, you can use labels:

              <ul>
                <li>`ds_name` — database cluster name;</li><li>`datname` — database name.</li>
              </ul>
            </td>
          </tr>

          <tr>
            <th>dbaas\_pg\_pgss\_query\_texts\_size\_bytes</th><td>Size of the statistics file from `pg_stat_statements` in bytes</td>
          </tr>

          <tr>
            <th>dbaas\_pg\_total\_wals\_size\_bytes</th><td>Size of the directory with WAL files in bytes</td>
          </tr>

          <tr>
            <th>dbaas\_pg\_tmp\_size\_bytes</th><td>Size of PostgreSQL temporary files in bytes</td>
          </tr>

          <tr>
            <th>dbaas\_databases\_size\_bytes</th>

            <td>
              Total database size in bytes. <br />For example, you can use the `datname` label — database name
            </td>
          </tr>

          <tr>
            <th>dbaas\_pg\_trx\_max\_age</th><td>Number of transactions performed after the last freeze using the VACUUM FREEZE or AUTOVACUUM operation</td>
          </tr>

          <tr>
            <th>dbaas\_pg\_trx\_percent\_before\_vacuum\_freeze</th><td>Shows how close the age of the oldest transaction in the database is to the threshold after which PostgreSQL forces the VACUUM FREEZE operation. The threshold is determined by the `autovacuum\_freeze\_max\_age` parameter</td>
          </tr>

          <tr>
            <th>dbaas\_pg\_trx\_percent\_before\_wraparound\_risk</th><td>Shows how much the age of the earliest transaction in the database has approached the threshold after which a transaction ID wraparound is possible (wraparound)</td>
          </tr>
        </tbody>
      </table>
    </CustomTable>
  </TabItem>
</Tabs>

<Formbricks />
