Monitoring of PostgreSQL cluster and databases for 1C
In PostgreSQL cloud databases for 1C, you can monitor the state of the cluster.
To assess the overall health of the cluster , look at the status of the cluster.
For more detailed analysis, some metrics can be viewed as graphs in the dashboard:
The full set of available metrics can be exported in Prometheus format.
You can tell if you are about to run out of disk space by using the disk fullness notification. When notified , clear the disk or scale the cluster and select a configuration with a larger disk size.
View cluster status
- In the Control panel, on the top menu, click Products and select Cloud Databases.
- Open the Active tab.
- In the cluster row, look at the status.
View the status of the node cluster
- In the Control panel, on the top menu, click Products and select Cloud Databases.
- Open the Active tab.
- Open the cluster page → Monitoring tab.
- In the Cluster Monitoring block, click Cluster Nodes.
- In the Server field, select the node whose metrics you want to view.
- Look at the available metrics of the node cluster.
Cluster node metrics in the control panel
View the status of the databases
- In the Control panel, on the top menu, click Products and select Cloud Databases.
- Open the Active tab.
- Open the cluster page → Monitoring tab.
- In the Cluster Monitoring block, click Databases.
- In the Server field, select the node whose database metrics you want to view.
- Take a look at the available database metrics.
Database metrics in the dashboard
View the status of the connection pooler
- In the Control panel, on the top menu, click Products and select Cloud Databases.
- Open the Active tab.
- Open the cluster page → Monitoring tab.
- In the Cluster Monitoring block, click Connection Pooler.
- In the Server field, select the node whose metrics you want to view.
- Look at the available metrics of the node cluster.
Connection pooler metrics in the control panel
Export metrics in Prometheus format
Historical information for clusters is not available — metrics are requested only in real time. The list of all metrics that are supported in cloud databases and their description can be viewed in the Metrics table in Prometheus format.
1. Get a token
The token gives access to the metrics of all project clusters in a single pool.
-
In the Control panel, on the top menu, click Products and select Cloud Databases.
-
Open the Active tab.
-
Open the cluster page → Monitoring tab.
-
In the Tokens for Prometheus block, click Add token. The token will be generated automatically.
-
Copy the token. To do this, click in the token line.
2. Get metrics in Prometheus format
Configuration file
CLI
-
Add to the Prometheus configuration file:
scrape_configs:
- job_name: get-metrics-from-dbaas
scrape_interval: 1m
static_configs:
- targets:
- '<pool>.dbaas.selcloud.ru'
scheme: https
authorization:
type: Bearer
credentials: <monitoring_token>Specify:
-
Open a page in your browser where Prometheus-formatted metrics will be available:
http://<ip_address>:9090/targets
Specify
<ip_address>
— the IP address where Prometheus is installed. -
Independently configure monitoring and alerts for database clusters.
-
Open the CLI.
-
To get metrics, submit a request:
curl -L "https://<pool>.dbaas.selcloud.ru/metrics" -H "Authorization: Bearer <monitoring_token>"
Specify:
<pool>
— pool in which the token is active, for exampleru-3
. Address (URL) depends on the region and pool, you can look in the URL list;<monitoring_token>
— The monitoring token you received earlier.
Available metrics in Prometheus format will appear in the response.
-
Independently configure monitoring and alerts for database clusters.
Metrics in Prometheus format
Metrics in Prometheus format are provided for all clusters. A specific cluster can be found by the database cluster identifier in the ds_id
label.
Infrastructure level metrics
Application level metrics
Disk fullness notifications
If the cluster disk is 80% full, a notification will appear in the dashboard and will be sent to the Account Owner's email and those users subscribed to the "Services and Services" notification category.
If the cluster disk is 95% full or more, the cluster will enter DISK_FULL
status and will be read-only. To make the cluster read-write , clear the disk or scale the cluster and select a configuration with a larger disk size.
Clear the disk
Open transaction transaction_read_only = no
and remove unnecessary data using one of the queries:
-
DROP TABLE
— deletes the structure (data, privileges, indexes, constraints, triggers). Use when completely deleting a table with data and structure:BEGIN;
SET transaction_read_only = no;
DROP TABLE table_name;
COMMIT; -
TRUNCATE TABLE
— deletes the contents of the table, but the structure is preserved. Works fasterDROP TABLE
. Use when deleting all rows of a table while preserving the table structure:BEGIN;
SET transaction_read_only = no;
TRUNCATE TABLE table_name;
COMMIT; -
DELETE
— use to delete specific strings.
We do not recommend using the DELETE FROM table WHERE ...
query. to clean up disk space. This query can create oversized selections on large tables and place them on disk. The remaining free disk space may run out completely, leading to problems with PostgreSQL and the need to restore it manually.