Skip to main content

Monitoring of PostgreSQL cluster, nodes, and databases

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

To assess the overall cluster state, check its status.

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

The full set of available metrics can be exported 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 created a cluster in Tashkent, in the uz-1 pool. Tashkent is in the UTC+5 time zone. The device you used to access the control panel is set to the UTC+3 time zone. The time on the metrics charts will be displayed in UTC+3.

View cluster status

  1. In the control panel, in the top menu, click Products and select Managed Databases.

  2. Open the Active tab.

  3. Check the status in the cluster row.

    ACTIVECluster is available
    CREATINGCluster is being created
    UPDATINGThe cluster is updating
    RESIZINGCluster is being scaled
    ERRORAn error occurred, create a ticket
    DISK FULL

    The disk is full, the cluster is read-only. For the cluster to work in read-write mode, clean up the disk or scale the cluster and select a configuration with a larger disk size

    DEGRADEDSome cluster nodes are unavailable
    DELETINGCluster is being deleted

View cluster node status

  1. In the control panel, in 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 whose metrics you want to view.
  6. View the available cluster node metrics.

Cluster node metrics in the control panel

MemoryOccupied memory excluding operating system cache and buffers, as a percentage or in gigabytes
vCPUPercentage of cluster node core utilization
CPU iowaitPercentage of time the processor spent waiting for input/output
Volume

Used disk space as a percentage or in gigabytes. Accounts for the disk space reserved for system needs and unavailable for database storage. For more information about disk space reservation, see the Disk space usage in the PostgreSQL cluster instructions

Load Average

The average system load over a period of time. It shows how many processes are being processed by the cluster cores. The indicator is presented in the form of three values — for 1, 5, and 15 minutes. These values should not be greater than the number of cores on the node

OOM

Number of processes that failed with an Out of Memory error due to a lack of RAM

Disk load

Data read and write speed in KB/s or the number of read and write operations per second

Network loadNumber of bits or packets sent and received via the network interface

View database status

  1. In the control panel, in 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 whose metrics you want to view.
  6. View the available database metrics.

Database metrics in the control panel

Statistics file sizeTotal size of the statistics file in kilobytes
Cache hitPercentage of query data read from cache — ratio of blks_hit to the sum of blks_hit and blks_read
Row operations

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

  • tup_deleted — number of rows deleted by operations per second;
  • tup_fetched — number of rows fetched by operations per second;
  • tup_inserted — number of rows inserted by operations per second;
  • tup_returned — number of rows returned by operations per second;
  • tup_updated — number of rows updated by operations per second
LocksNumber of locks in each database of the cluster
DeadlocksNumber of deadlocks in each database
TransactionsNumber of transactions per second in each database of the cluster
ConnectionsNumber of connections to each database of the cluster and the total number of connections to all databases
Temporary file sizeTotal size of temporary files in kilobytes
WAL file sizeTotal size of WAL files in megabytes
Execution time of the longest queryExecution time of the longest query in each database of the cluster over a period of time
Database sizeTotal size of the selected database in megabytes

View connection pooler status

  1. In the control panel, in 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 whose metrics you want to view.
  6. View the available connection pooler metrics.

Connection pooler metrics in the control panel

Maximum client wait time in queueMaximum client wait time in queue in the selected database in seconds
Wait time for response from serverWait time for response from node in the selected database in seconds
Active server connectionsNumber of server connections associated with clients in the selected database
Client connections to the pool

Number of client connections to the pool in the selected database:

  • pools_client_active_connections — number of client connections linked to server connections or idle without queries;
  • pools_client_waiting_connections — number of client connections where a query has been sent, but there is no connection to the node yet

Export metrics in Prometheus format

Historical data is not available for clusters — metrics are requested in real time only. The list of all metrics supported in Managed Databases and their descriptions can be found in the Metrics in Prometheus format table.

  1. Get a token.
  2. Get metrics in Prometheus format.

1. Get token

The token provides access to the metrics of all clusters of the project in a single pool.

  1. In the control panel, in 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, in the token row, click .

2. Get metrics in Prometheus format

  1. Add to the Prometheus configuration file:

    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 the part of the URL used to access the API without https:// and /v1, for example, uz-1.dbaas.api.servercore.com . The URL depends on the region and pool and can be found in the Managed Databases subsection of the List of URLs guide;
    • <token> — token you copied when getting a token in step 5.
  2. Open in your browser the page where metrics in Prometheus format will be available:

    http://<ip_address>:9090/targets

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

  3. Configure monitoring and alerts for database clusters yourself.

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.

dbaas_memory_percentOccupied memory excluding operating system cache and buffers (RAM) as a percentage
dbaas_memory_bytesOccupied memory excluding operating system cache and buffers (RAM) in bytes
dbaas_oom_countNumber of processes that failed with an Out of Memory error due to a lack of RAM
dbaas_cpuvCPU utilization on database cluster nodes as a percentage
dbaas_cpu_iowaitInput/output wait time as a percentage
dbaas_disk_percent

Used disk space as a percentage. Accounts for the disk space reserved for system needs and unavailable for database storage. For more information about disk space reservation, see the Disk space usage in the PostgreSQL cluster instructions

dbaas_disk_bytes

Used disk space in bytes. Accounts for the disk space reserved for system needs and unavailable for database storage. For more information about disk space reservation, see the Disk space usage in the PostgreSQL cluster instructions

dbaas_disk_read_iopsNumber of read operations per second
dbaas_disk_write_iopsNumber of write operations per second
dbaas_disk_read_bytesDisk read speed in bytes per second
dbaas_disk_write_bytesDisk write speed in bytes per second
dbaas_node_load1Average system load over one minute. Shows how many processes are being handled by the cluster cores
dbaas_node_load5Average system load over five minutes. Shows how many processes are being handled by the cluster cores
dbaas_node_load15Average system load over 15 minutes. Shows how many processes are being handled by the cluster cores
dbaas_network_receive_bytesNumber of bytes received via the network interface
dbaas_network_transmit_bytesNumber of bytes sent via the network interface
dbaas_network_receive_packetsNumber of packets received via the network interface per second
dbaas_network_transmit_packetsNumber of packets sent via the network interface per second
dbaas_role

Node role:

  • 0 — unknown role;
  • 1 — master;
  • 2 — replica