diff --git a/ydb/docs/en/core/reference/ydb-sdk/_assets/hc_cards_hierarchy.png b/ydb/docs/en/core/reference/ydb-sdk/_assets/hc_cards_hierarchy.png new file mode 100644 index 000000000000..56456b2b9c78 Binary files /dev/null and b/ydb/docs/en/core/reference/ydb-sdk/_assets/hc_cards_hierarchy.png differ diff --git a/ydb/docs/en/core/reference/ydb-sdk/_assets/hc_types_hierarchy.png b/ydb/docs/en/core/reference/ydb-sdk/_assets/hc_types_hierarchy.png new file mode 100644 index 000000000000..a30d102acf8d Binary files /dev/null and b/ydb/docs/en/core/reference/ydb-sdk/_assets/hc_types_hierarchy.png differ diff --git a/ydb/docs/en/core/reference/ydb-sdk/health-check-api.md b/ydb/docs/en/core/reference/ydb-sdk/health-check-api.md index 946f67bd5967..f3f1b1b1bd74 100644 --- a/ydb/docs/en/core/reference/ydb-sdk/health-check-api.md +++ b/ydb/docs/en/core/reference/ydb-sdk/health-check-api.md @@ -1,26 +1,93 @@ # Health Check API -{{ ydb-short-name }} has a built-in self-diagnostic system, which can be used to get a brief report on the database status and information about existing problems. +{{ ydb-short-name }} has a built-in self-diagnostic system, which can be used to get a brief report on the database status and information about existing issues. -To initiate the check, call the `SelfCheck` method from `Ydb.Monitoring`. You must also pass the name of the checked DB as usual. +To initiate the check, call the `SelfCheck` method from `NYdb::NMonitoring` namespace in the SDK. You must also pass the name of the checked DB as usual. -Calling the method will return the following structure: +{% list tabs %} + +- C++ + + App code snippet for creating a client: + ```cpp + auto client = NYdb::NMonitoring::TMonitoringClient(driver); + ``` + + Calling `SelfCheck` method: + + ``` + auto settings = TSelfCheckSettings(); + settings.ReturnVerboseStatus(true); + auto result = client.SelfCheck(settings).GetValueSync(); + ``` + +{% endlist %} + +## Call parameters {#call-parameters} + +`SelfCheck` method provides information in the form of a [set of issues](#example-emergency) which could look like this: + +```json +{ + "id": "RED-27c3-70fb", + "status": "RED", + "message": "Database has multiple issues", + "location": { + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-27c3-4e47", + "RED-27c3-53b5", + "YELLOW-27c3-5321" + ], + "type": "DATABASE", + "level": 1 +} +``` + +This is a short messages each about a single issue. All parameters will affect the amount of information the service returns for the specified database. + +The complete list of extra parameters is presented below: + +{% list tabs %} + +- C++ + + ```c++ + struct TSelfCheckSettings : public TOperationRequestSettings{ + FLUENT_SETTING_OPTIONAL(bool, ReturnVerboseStatus); + FLUENT_SETTING_OPTIONAL(EStatusFlag, MinimumStatus); + FLUENT_SETTING_OPTIONAL(ui32, MaximumLevel); + }; + ``` + +{% endlist %} + +| Parameter | Type | Description | +|:----|:----|:----| +| `ReturnVerboseStatus` | `bool` | If `ReturnVerboseStatus` is specified, the response will also include a summary of the overall health of the database in the `database_status` field ([Example](#example-verbose)). Default is false. | +| `MinimumStatus` | [EStatusFlag] (#issue-status) | Each issue has a `status` field. If `minimum_status` is specified, issues with a higher `status` will be discarded. By default, all issues will be listed. | +| `MaximumLevel` | `int32` | Each issue has a `level` field. If `maximum_level` is specified, issues with deeper levels will be discarded. By default, all issues will be listed. | + +## Response structure {#response-structure} + +For the full response structure, see the [ydb_monitoring.proto](https://github.com/ydb-platform/ydb/public/api/protos/ydb_monitoring.proto) file in the {{ ydb-short-name }} Git repository. +Calling the `SelfCheck` method will return the following message: ```protobuf message SelfCheckResult { SelfCheck.Result self_check_result = 1; repeated IssueLog issue_log = 2; + repeated DatabaseStatus database_status = 3; + LocationNode location = 4; } ``` -The `self_check_result` field of the `enum` type contains the DB check result: +The shortest `HealthCheck` response looks like [this](#examples) . It is returned if there is nothing wrong with the database. -* `GOOD`: No problems were detected. -* `DEGRADED`: Degradation of one of the database systems was detected, but the database is still functioning (for example, allowable disk loss). -* `MAINTENANCE_REQUIRED`: Significant degradation was detected, there is a risk of accessibility loss, and human intervention is required. -* `EMERGENCY`: A serious problem was detected in the database, with complete or partial loss of accessibility. - -If problems are detected, the `issue_log` field will contain problem descriptions with the following structure: +If any issues are detected, the `issue_log` field will contain descriptions of the issues with the following structure: ```protobuf message IssueLog { @@ -34,38 +101,746 @@ message IssueLog { } ``` -* `id`: A unique problem ID within this response. -* `status`: Status (severity) of the current problem. It can take one of the following values: - - * `RED`: A component is faulty or unavailable. - * `ORANGE`: A serious problem, we are one step away from losing accessibility. Intervention may be required. - * `YELLOW`: A minor problem, no risks to accessibility. We recommend you continue monitoring the problem. - * `BLUE`: Temporary minor degradation that does not affect database accessibility. - * `GREEN`: No problems were detected. - * `GREY`: Failed to determine the status (a problem with the self-diagnostic mechanism). - -* `message`: [Text that describes the problem](#problems). -* `location`: Location of the problem. -* `reason`: Possible IDs of the nested problems that led to the current problem. -* `type`: Problem category (by subsystem). -* `level`: Depth of the problem nesting. - -## Possible problems {#problems} - -* `Pool usage over 90/95/99%`: One of the pools' CPUs is overloaded. -* `System tablet is unresponsive / response time over 1000ms/5000ms`: The system tablet is not responding or it takes too long to respond. -* `Tablets are restarting too often`: Tablets are restarting too often. -* `Tablets are dead`: Tablets are not started (or cannot be started). -* `LoadAverage above 100%`: A physical host is overloaded. -* `There are no compute nodes`: The database has no nodes to start the tablets. -* `PDisk state is ...`: Indicates problems with a physical disk. -* `PDisk is not available`: A physical disk is not available. -* `Available size is less than 12%/9%/6%`: Free space on the physical disk is running out. -* `VDisk is not available`: A virtual disk is not available. -* `VDisk state is ...`: Indicates problems with a virtual disk. -* `DiskSpace is ...`: Indicates problems with virtual disk space. -* `Storage node is not available`: A node with disks is not available. -* `Replication in progress`: Disk replication is in progress. -* `Group has no redundancy`: A storage group lost its redundancy. -* `Group failed`: A storage group lost its integrity. -* `Group degraded`: The number of disks allowed in the group is not available. + +### Description of fields in the response {#fields-description} + +| Field | Description | +|:----|:----| +| `self_check_result` | enum field which contains the [database check result](#selfcheck-result) | +| `issue_log.id` | A unique issue ID within this response. | +| `issue_log.status` | enum field which contains the [issue status](#issue-status) | +| `issue_log.message` | Text that describes the issue. | +| `issue_log.location` | Location of the issue. This can be a physical location or an execution context. | +| `issue_log.reason` | This is a set of elements, each of which describes an issue in the system at a certain level. | +| `issue_log.type` | Issue category (by subsystem). Each type is at a certain level and interconnected with others through a [rigid hierarchy](#issues-hierarchy) (as shown in the picture above). | +| `issue_log.level` | Issue [nesting depth](#issues-hierarchy). | +| `database_status` | If the settings include `ReturnVerboseStatus` parameter, the `database_status` field will be populated.
This field offers a comprehensive summary of the overall health of the database.
It is designed to provide a quick overview of the database's condition, helping to assess its health and identify any major issuehs at a high level. [Example](#example-verbose). For the full response structure, see the [ydb_monitoring.proto](https://github.com/ydb-platform/ydb/public/api/protos/ydb_monitoring.proto) file in the {{ ydb-short-name }} Git repository. | +| `location` | Contains information about the host, where the `HealthCheck` service was called | + +### Issues hierarchy {#issues-hierarchy} + +Issues can be arranged hierarchically using the `id` and `reason` fields, which help visualize how issues in different modules affect the overall system state. All issues are arranged in a hierarchy where higher levels can depend on nested levels: + +![cards_hierarchy](./_assets/hc_cards_hierarchy.png) + +Each issue has a nesting `level`. The higher the `level`, the deeper the issue is within the hierarchy. Issues with the same `type` always have the same `level`, and they can be represented hierarchically. + +![issues_hierarchy](./_assets/hc_types_hierarchy.png) + +#### Database check result {#selfcheck-result} + +The most general status of the database. It can have the following values: + +| Value | Description | +|:----|:----| +| `GOOD` | No issues were detected. | +| `DEGRADED` | Degradation of at least one of the database systems was detected, but the database is still functioning (for example, allowable disk loss). | +| `MAINTENANCE_REQUIRED` | Significant degradation was detected, there is a risk of database unavailability, and human intervention is required. | +| `EMERGENCY` | A serious problem was detected in the database, with complete or partial unavailability. | + +#### Issue status {#issue-status} + +The status (severity) of the current issue: + +| Value | Description | +|:----|:----| +| `GREY` | Unable to determine the status (an issue with the self-diagnostic subsystem). | +| `GREEN` | No issues detected. | +| `BLUE` | Temporary minor degradation that does not affect database availability; the system is expected to return to `GREEN`. | +| `YELLOW` | A minor issue with no risks to availability. It is recommended to continue monitoring the issue. | +| `ORANGE` | A serious issue, a step away from losing availability. Maintenance may be required. | +| `RED` | A component is faulty or unavailable. | + +## Possible issues {#issues} + +### DATABASE + +#### Database has multiple issues, Database has compute issues, Database has storage issues + +**Description:** These issues depend solely on the underlying `COMPUTE` and `STORAGE` layers. This represents the most general status of a database. + +### STORAGE + +#### There are no storage pools + +**Description:** Information about storage pools is unavailable. Most likely, the storage pools are not configured. + +#### Storage degraded, Storage has no redundancy, Storage failed + +**Description:** These issues depend solely on the underlying `STORAGE_POOLS` layer. + +#### System tablet BSC didn't provide information + +**Description:** Storage diagnostics will be generated using an alternative method. + +#### Storage usage over 75%, Storage usage over 85%, Storage usage over 90% + +**Description:** Some data needs to be removed, or the database needs to be reconfigured with additional disk space. + +### STORAGE_POOL + +#### Pool degraded, Pool has no redundancy, Pool failed + +**Description:** These issues depend solely on the underlying `STORAGE_GROUP` layer. + +### STORAGE_GROUP + +#### Group has no vslots + +**Description:** This situation is not expected; it is an internal issue. + +#### Group degraded + +**Description:** A number of disks allowed in the group are not available. + +**Logic of work:** `HealthCheck` checks various parameters (fault tolerance mode, number of failed disks, disk status, etc.) and sets the appropriate status for the group accordingly. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, apply the `Groups` and `Degraded` filters, and use the known group `id` to check the availability of nodes and disks on the nodes. + +#### Group has no redundancy + +**Description:** A storage group has lost its redundancy. Another VDisk failure could result in the loss of the group. + +**Logic of work:** `HealthCheck` monitors various parameters (fault tolerance mode, number of failed disks, disk status, etc.) and sets the appropriate status for the group based on these parameters. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, apply the `Groups` and `Degraded` filters, and use the known group `id` to check the availability of nodes and disks on those nodes. + +#### Group failed + +**Description:** A storage group has lost its integrity, and data is no longer available. `HealthCheck` evaluates various parameters (fault tolerance mode, number of failed disks, disk status, etc.) and determines the appropriate status, displaying a message accordingly. + +**Logic of work:** `HealthCheck` monitors various parameters (fault tolerance mode, number of failed disks, disk status, etc.) and sets the appropriate status for the group accordingly. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, apply the `Groups` and `Degraded` filters, and use the known group `id` to check the availability of nodes and disks on those nodes.``` + +### VDISK + +#### System tablet BSC did not provide known status + +**Description:** This situation is not expected; it is an internal issue. + +#### VDisk is not available + +**Description:** The disk is not operational. + +**Actions:** In [YDB Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, and apply the `Groups` and `Degraded` filters. The group `id` can be found through the related `STORAGE_GROUP` issue. Hover over the relevant VDisk to identify the node with the problem and check the availability of nodes and disks on those nodes. + +#### VDisk is being initialized + +**Description:** The disk is in the process of initialization. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, and apply the `Groups` and `Degraded` filters. The group `id` can be found through the related `STORAGE_GROUP` issue. Hover over the relevant VDisk to identify the node with the problem and check the availability of nodes and disks on those nodes. + +#### Replication in progress + +#### Replication in progress + +**Description:** The disk is accepting queries, but not all data has been replicated. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, and apply the `Groups` and `Degraded` filters. The group `id` can be found through the related `STORAGE_GROUP` issue. Hover over the relevant VDisk to identify the node with the problem and check the availability of nodes and disks on those nodes. + +#### VDisk have space issue + +**Description:** These issues depend solely on the underlying `PDISK` layer. + +### PDISK + +#### Unknown PDisk state + +**Description:** `HealthCheck` the system can't parse pdisk state. + +#### PDisk state is ... + +**Description:** Indicates state of physical disk. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, set the `Nodes` and `Degraded` filters, and use the known node id and PDisk to check the availability of nodes and disks on the nodes. + +#### Available size is less than 12%, Available size is less than 9%, Available size is less than 6% + +**Description:** Free space on the physical disk is running out. +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, set the `Nodes` and `Out of Space` filters, and use the known node and PDisk identifiers to check the available space. + +#### PDisk is not available + +**Description:** A physical disk is not available. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the database page, select the `Storage` tab, set the `Nodes` and `Degraded` filters, and use the known node and PDisk identifiers to check the availability of nodes and disks on the nodes. + +### STORAGE_NODE + +#### Storage node is not available + +**Description:** A storage node is not available. + +### COMPUTE + +#### There are no compute nodes + +**Description:** The database has no nodes available to start the tablets. Unable to determine `COMPUTE_NODE` issues below. + +#### Compute has issues with system tablets + +**Description:** These issues depend solely on the underlying `SYSTEM_TABLET` layer. + +#### Some nodes are restarting too often + +**Description:** These issues depend solely on the underlying `NODE_UPTIME` layer. + +#### Compute is overloaded + +**Description:** These issues depend solely on the underlying `COMPUTE_POOL` layer. + +#### Compute quota usage + +**Description:** These issues depend solely on the underlying `COMPUTE_QUOTA` layer. + +#### Compute has issues with tablets + +**Description:** These issues depend solely on the underlying `TABLET` layer. + +### COMPUTE_QUOTA + +#### Paths quota usage is over than 90%, Paths quota usage is over than 99%, Paths quota exhausted, Shards quota usage is over than 90%, Shards quota usage is over than 99%, Shards quota exhausted + +**Description:** Quotas are exhausted. + +**Actions:** Check the number of objects (tables, topics) in the database and delete any unnecessary ones. + +### SYSTEM_TABLET + +#### System tablet is unresponsive, System tablet response time over 1000ms, System tablet response time over 5000ms + +**Description:** The system tablet is either not responding or takes too long to respond. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the `Storage` tab and apply the `Nodes` filter. Check the `Uptime` and the nodes' statuses. If the `Uptime` is short, review the logs to determine the reasons for the node restarts. + +### TABLET + +#### Tablets are restarting too often + +**Description:** Tablets are restarting too frequently. + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the `Nodes` tab. Check the `Uptime` and the nodes' statuses. If the `Uptime` is short, review the logs to determine the reasons for the node restarts. + +#### Tablets/Followers are dead + +**Description:** Tablets are not running (likely cannot be started). + +**Actions:** In [Embedded UI](../embedded-ui/ydb-monitoring.md), navigate to the `Nodes` tab. Check the `Uptime` and the nodes' statuses. If the `Uptime` is short, review the logs to determine the reasons for the node restarts. + +### LOAD_AVERAGE + +#### LoadAverage above 100% + +### LOAD_AVERAGE + +#### LoadAverage above 100% + +**Description:** A physical host is overloaded, meaning the system is operating at or beyond its capacity, potentially due to a high number of processes waiting for I/O operations. For more information on load, see [Load (computing)](https://en.wikipedia.org/wiki/Load_(computing)). + +**Logic of work:** + +- Load Information: + + - Source: `/proc/loadavg` + - The first number of the three represents the average load over the last 1 minute. + +- Logical Cores Information: + + - Primary Source: `/sys/fs/cgroup/cpu.max` + - Fallback Sources: `/sys/fs/cgroup/cpu/cpu.cfs_quota_us`, `/sys/fs/cgroup/cpu/cpu.cfs_period_us` +- + The number of cores is calculated by dividing the quota by the period (quota / period). + +**Actions:** Check the CPU load on the nodes. + +### COMPUTE_POOL + +#### Pool usage is over than 90%, Pool usage is over than 95%, Pool usage is over than 99% + +**Description:** One of the pools' CPUs is overloaded. + +**Actions:** Add cores to the configuration of the actor system for the corresponding CPU pool. + +### NODE_UPTIME + +#### The number of node restarts has increased + +**Description:** The number of node restarts has exceeded the threshold. By default, this is set to 10 restarts per hour. + +**Actions:** Check the logs to determine the reasons for the process restarts. + +#### Node is restarting too often + +**Description:** The number of node restarts has exceeded the threshold. By default, this is set to 30 restarts per hour. + +**Actions:** Check the logs to determine the reasons for the process restarts. + +### NODES_TIME_DIFFERENCE + +#### Node is ... ms behind peer [id], Node is ... ms ahead of peer [id] + +**Description:** Time drift on nodes might lead to potential issues with coordinating distributed transactions. This issue starts to appear when the time difference is 5 ms or more. + +**Actions:** Check for discrepancies in system time between the nodes listed in the alert, and verify the operation of the time synchronization process. + +## Examples {#examples} + +The shortest `HealthCheck` response looks like this. It is returned if there is nothing wrong with the database: + +```json +{ + "self_check_result": "GOOD" +} +``` + +### Verbose example {#example-verbose} + +`GOOD` response with `verbose` parameter: + +```json +{ + "self_check_result": "GOOD", + "database_status": [ + { + "name": "/amy/db", + "overall": "GREEN", + "storage": { + "overall": "GREEN", + "pools": [ + { + "id": "/amy/db:ssdencrypted", + "overall": "GREEN", + "groups": [ + { + "id": "2181038132", + "overall": "GREEN", + "vdisks": [ + { + "id": "9-1-1010", + "overall": "GREEN", + "pdisk": { + "id": "9-1", + "overall": "GREEN" + } + }, + { + "id": "11-1004-1009", + "overall": "GREEN", + "pdisk": { + "id": "11-1004", + "overall": "GREEN" + } + }, + { + "id": "10-1003-1011", + "overall": "GREEN", + "pdisk": { + "id": "10-1003", + "overall": "GREEN" + } + }, + { + "id": "8-1005-1010", + "overall": "GREEN", + "pdisk": { + "id": "8-1005", + "overall": "GREEN" + } + }, + { + "id": "7-1-1008", + "overall": "GREEN", + "pdisk": { + "id": "7-1", + "overall": "GREEN" + } + }, + { + "id": "6-1-1007", + "overall": "GREEN", + "pdisk": { + "id": "6-1", + "overall": "GREEN" + } + }, + { + "id": "4-1005-1010", + "overall": "GREEN", + "pdisk": { + "id": "4-1005", + "overall": "GREEN" + } + }, + { + "id": "2-1003-1013", + "overall": "GREEN", + "pdisk": { + "id": "2-1003", + "overall": "GREEN" + } + }, + { + "id": "1-1-1008", + "overall": "GREEN", + "pdisk": { + "id": "1-1", + "overall": "GREEN" + } + } + ] + } + ] + } + ] + }, + "compute": { + "overall": "GREEN", + "nodes": [ + { + "id": "50073", + "overall": "GREEN", + "pools": [ + { + "overall": "GREEN", + "name": "System", + "usage": 0.000405479 + }, + { + "overall": "GREEN", + "name": "User", + "usage": 0.00265229 + }, + { + "overall": "GREEN", + "name": "Batch", + "usage": 0.000347933 + }, + { + "overall": "GREEN", + "name": "IO", + "usage": 0.000312022 + }, + { + "overall": "GREEN", + "name": "IC", + "usage": 0.000945925 + } + ], + "load": { + "overall": "GREEN", + "load": 0.2, + "cores": 4 + } + }, + { + "id": "50074", + "overall": "GREEN", + "pools": [ + { + "overall": "GREEN", + "name": "System", + "usage": 0.000619053 + }, + { + "overall": "GREEN", + "name": "User", + "usage": 0.00463859 + }, + { + "overall": "GREEN", + "name": "Batch", + "usage": 0.000596071 + }, + { + "overall": "GREEN", + "name": "IO", + "usage": 0.0006241 + }, + { + "overall": "GREEN", + "name": "IC", + "usage": 0.00218465 + } + ], + "load": { + "overall": "GREEN", + "load": 0.08, + "cores": 4 + } + }, + { + "id": "50075", + "overall": "GREEN", + "pools": [ + { + "overall": "GREEN", + "name": "System", + "usage": 0.000579126 + }, + { + "overall": "GREEN", + "name": "User", + "usage": 0.00344293 + }, + { + "overall": "GREEN", + "name": "Batch", + "usage": 0.000592347 + }, + { + "overall": "GREEN", + "name": "IO", + "usage": 0.000525747 + }, + { + "overall": "GREEN", + "name": "IC", + "usage": 0.00174265 + } + ], + "load": { + "overall": "GREEN", + "load": 0.26, + "cores": 4 + } + } + ], + "tablets": [ + { + "overall": "GREEN", + "type": "SchemeShard", + "state": "GOOD", + "count": 1 + }, + { + "overall": "GREEN", + "type": "SysViewProcessor", + "state": "GOOD", + "count": 1 + }, + { + "overall": "GREEN", + "type": "Coordinator", + "state": "GOOD", + "count": 3 + }, + { + "overall": "GREEN", + "type": "Mediator", + "state": "GOOD", + "count": 3 + }, + { + "overall": "GREEN", + "type": "Hive", + "state": "GOOD", + "count": 1 + } + ] + } + } + ] +} +``` + +### Emergency example {#example-emergency} + +Response with `EMERGENCY` status: + +```json +{ + "self_check_result": "EMERGENCY", + "issue_log": [ + { + "id": "RED-27c3-70fb", + "status": "RED", + "message": "Database has multiple issues", + "location": { + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-27c3-4e47", + "RED-27c3-53b5", + "YELLOW-27c3-5321" + ], + "type": "DATABASE", + "level": 1 + }, + { + "id": "RED-27c3-4e47", + "status": "RED", + "message": "Compute has issues with system tablets", + "location": { + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-27c3-c138-BSController" + ], + "type": "COMPUTE", + "level": 2 + }, + { + "id": "RED-27c3-c138-BSController", + "status": "RED", + "message": "System tablet is unresponsive", + "location": { + "compute": { + "tablet": { + "type": "BSController", + "id": [ + "72057594037989391" + ] + } + }, + "database": { + "name": "/slice" + } + }, + "type": "SYSTEM_TABLET", + "level": 3 + }, + { + "id": "RED-27c3-53b5", + "status": "RED", + "message": "System tablet BSC didn't provide information", + "location": { + "database": { + "name": "/slice" + } + }, + "type": "STORAGE", + "level": 2 + }, + { + "id": "YELLOW-27c3-5321", + "status": "YELLOW", + "message": "Storage degraded", + "location": { + "database": { + "name": "/slice" + } + }, + "reason": [ + "YELLOW-27c3-595f-8d1d" + ], + "type": "STORAGE", + "level": 2 + }, + { + "id": "YELLOW-27c3-595f-8d1d", + "status": "YELLOW", + "message": "Pool degraded", + "location": { + "storage": { + "pool": { + "name": "static" + } + }, + "database": { + "name": "/slice" + } + }, + "reason": [ + "YELLOW-27c3-ef3e-0" + ], + "type": "STORAGE_POOL", + "level": 3 + }, + { + "id": "RED-84d8-3-3-1", + "status": "RED", + "message": "PDisk is not available", + "location": { + "storage": { + "node": { + "id": 3, + "host": "man0-0026.ydb-dev.nemax.nebiuscloud.net", + "port": 19001 + }, + "pool": { + "group": { + "vdisk": { + "pdisk": [ + { + "id": "3-1", + "path": "/dev/disk/by-partlabel/NVMEKIKIMR01" + } + ] + } + } + } + } + }, + "type": "PDISK", + "level": 6 + }, + { + "id": "RED-27c3-4847-3-0-1-0-2-0", + "status": "RED", + "message": "VDisk is not available", + "location": { + "storage": { + "node": { + "id": 3, + "host": "man0-0026.ydb-dev.nemax.nebiuscloud.net", + "port": 19001 + }, + "pool": { + "name": "static", + "group": { + "vdisk": { + "id": [ + "0-1-0-2-0" + ] + } + } + } + }, + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-84d8-3-3-1" + ], + "type": "VDISK", + "level": 5 + }, + { + "id": "YELLOW-27c3-ef3e-0", + "status": "YELLOW", + "message": "Group degraded", + "location": { + "storage": { + "pool": { + "name": "static", + "group": { + "id": [ + "0" + ] + } + } + }, + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-27c3-4847-3-0-1-0-2-0" + ], + "type": "STORAGE_GROUP", + "level": 4 + } + ], + "location": { + "id": 5, + "host": "man0-0028.ydb-dev.nemax.nebiuscloud.net", + "port": 19001 + } +} +``` diff --git a/ydb/docs/ru/core/reference/ydb-sdk/_assets/hc_cards_hierarchy.png b/ydb/docs/ru/core/reference/ydb-sdk/_assets/hc_cards_hierarchy.png new file mode 100644 index 000000000000..56456b2b9c78 Binary files /dev/null and b/ydb/docs/ru/core/reference/ydb-sdk/_assets/hc_cards_hierarchy.png differ diff --git a/ydb/docs/ru/core/reference/ydb-sdk/_assets/hc_types_hierarchy.png b/ydb/docs/ru/core/reference/ydb-sdk/_assets/hc_types_hierarchy.png new file mode 100644 index 000000000000..a30d102acf8d Binary files /dev/null and b/ydb/docs/ru/core/reference/ydb-sdk/_assets/hc_types_hierarchy.png differ diff --git a/ydb/docs/ru/core/reference/ydb-sdk/health-check-api.md b/ydb/docs/ru/core/reference/ydb-sdk/health-check-api.md index 8099ff9373dd..5e940b6057b8 100644 --- a/ydb/docs/ru/core/reference/ydb-sdk/health-check-api.md +++ b/ydb/docs/ru/core/reference/ydb-sdk/health-check-api.md @@ -2,25 +2,90 @@ {{ ydb-short-name }} имеет встроенную систему самодиагностики, с помощью которой можно получить краткий отчет о состоянии базы данных и информацию об имеющихся проблемах. -Для инициации проверки необходимо сделать вызов метода `SelfCheck` из сервиса `Ydb.Monitoring`. Также необходимо передать имя проверяемой БД стандартным способом. +Чтобы инициировать проверку, вызовите метод `SelfCheck` из пространства имен `NYdb::NMonitoring` в SDK. Также необходимо передать имя проверяемой БД стандартным способом. +{% list tabs %} + +- C++ + + Пример кода приложения для создания клиента: + ```cpp + auto client = NYdb::NMonitoring::TMonitoringClient(driver); + ``` + + Вызов метода `SelfCheck`: + + ``` + auto settings = TSelfCheckSettings(); + settings.ReturnVerboseStatus(true); + auto result = client.SelfCheck(settings).GetValueSync(); + ``` + +{% endlist %} + +## Параметры вызова {#call-parameters} + +`SelfCheck` возвращает информацию в форме [списка проблем](#example-emergency), каждая из которых может выглядеть так: + +```json +{ + "id": "RED-27c3-70fb", + "status": "RED", + "message": "Database has multiple issues", + "location": { + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-27c3-4e47", + "RED-27c3-53b5", + "YELLOW-27c3-5321" + ], + "type": "DATABASE", + "level": 1 +} +``` + +Это короткое сообщение об одной из проблем. Все параметры вызова могут влиять на размер информации, которая содержится в ответе. + +Полный список дополнительных параметров представлен ниже: + +{% list tabs %} + +- C++ + + ```c++ + struct TSelfCheckSettings : public TOperationRequestSettings{ + FLUENT_SETTING_OPTIONAL(bool, ReturnVerboseStatus); + FLUENT_SETTING_OPTIONAL(EStatusFlag, MinimumStatus); + FLUENT_SETTING_OPTIONAL(ui32, MaximumLevel); + }; + ``` + +{% endlist %} + +| Поле | Тип | Описание | +|:----|:----|:----| +| `ReturnVerboseStatus` | `bool` | Если задано, ответ также будет содержать сводку общего состояния базы данных в поле `database_status` ([Пример](#example-verbose)). По умолчанию — `false`. | +| `MinimumStatus` | [EStatusFlag](#issue-status) | Каждая проблема содержит поле `status`. Если `minimum_status` определён, проблемы с менее серьёзным статусом будут отброшены. По умолчанию будут перечислены все проблемы. | +| `MaximumLevel` | `int32` | Каждая проблема содержит поле `level`. Если `maximum_level` определён, более серьёзные проблемы будут отброшены. По умолчанию будут перечислены все проблемы. | + +## Структура ответа {#response-structure} + +Полную структуру ответа можно посмотреть в файле [ydb_monitoring.proto](https://github.com/ydb-platform/ydb/public/api/protos/ydb_monitoring.proto) в Git репозитории {{ ydb-short-name }}. В результате вызова этого метода будет возвращена следующая структура: ```protobuf message SelfCheckResult { SelfCheck.Result self_check_result = 1; repeated IssueLog issue_log = 2; + repeated DatabaseStatus database_status = 3; + LocationNode location = 4; } ``` -Поле `self_check_result` типа `enum` содержит результат проверки БД: - -* `GOOD` — проблем не обнаружено. -* `DEGRADED` — обнаружена деградация одной из систем базы, но база продолжает функционировать (например, допустимая потеря диска). -* `MAINTENANCE_REQUIRED` — обнаружена серьезная деградация, есть риск потери доступности, требуется вмешательство человека. -* `EMERGENCY` — в базе данных обнаружена серьезная проблема, полная или частичная потеря доступности. - -Поле `issue_log` в случае обнаружения проблем будет содержать описания проблем следующей структуры: +Если обнаружены проблемы, поле `issue_log` будет содержать описания этих проблем со следующей структурой: ```protobuf message IssueLog { @@ -34,36 +99,718 @@ message IssueLog { } ``` -* `id` — уникальный идентификатор проблемы в рамках данного ответа. -* `status` — статус (серьезность) текущей проблемы. Может принимать одно из следующих значений: - * `RED` — компонента неисправна или недоступна. - * `ORANGE` — серьезная проблема, мы в одном шаге от потери доступности. Возможно требуется вмешательство. - * `YELLOW` — небольшая проблема, не создающая риски для доступности. Рекомендуется продолжить наблюдение за проблемой. - * `BLUE` — временная легкая деградация, не влияющая на доступность базы. - * `GREEN` — проблемы не обнаружено. - * `GREY` — статус определить не удалось (проблема с самим механизмом самодиагностики). -* `message` — [текст, описывающий проблему](#problems). -* `location` — местоположение проблемы. -* `reason` — возможные идентификаторы вложенных проблем, которые привели к текущей проблеме. -* `type` — категория проблемы (по подсистемам). -* `level` — глубина вложенности проблемы. - -## Возможные проблемы {#problems} - -* `Pool usage over 90/95/99%` — один из CPU пулов перегружен. -* `System tablet is unresponsive / response time over 1000ms/5000ms` — системная таблетка не отвечает или отвечает долго. -* `Tablets are restarting too often` — таблетки слишком часто перезапускаются. -* `Tablets are dead` — таблетки не запущены (или не могут быть запущены). -* `LoadAverage above 100%` — физический хост перегружен. -* `There are no compute nodes` — у базы нет нод для запуска таблеток. -* `PDisk state is ...` — сообщает о проблемах с физическим диском. -* `PDisk is not available` — отсутствует физический диск. -* `Available size is less than 12%/9%/6%` — заканчивается свободное место на физическом диске. -* `VDisk is not available` — отсутствует виртуальный диск. -* `VDisk state is ...` — сообщает о проблемах с виртуальным диском. -* `DiskSpace is ...` — сообщает о проблемах с местом на виртуальном диске. -* `Storage node is not available` — отсутствует нода с дисками. -* `Replication in progress` — диск в процессе репликации. -* `Group has no redundancy` — группа хранения потеряла избыточность. -* `Group failed` — группа хранения потеряла целостность. -* `Group degraded` — в группе недоступно допустимое число дисков. +### Описание полей в ответе {#fields-Описание} + +| Поле | Описание | +|:----|:----| +| `self_check_result` | Перечисляемое поле, содержащее [результат проверки базы данных](#selfcheck-result). | +| `issue_log` | Набор элементов, каждый из которых описывает проблему в системе на определённом уровне. | +| `issue_log.id` | Уникальный идентификатор проблемы в этом ответе. | +| `issue_log.status` | Перечисляемое поле, содержащее [статус проблемы](#issue-status). | +| `issue_log.message` | Текст, описывающий проблему. | +| `issue_log.location` | Местоположение проблемы. Это может быть физическое местоположение или контекст выполнения. | +| `issue_log.reason` | Набор элементов, каждый из которых описывает причину проблемы в системе на определённом уровне. | +| `issue_log.type` | Категория проблемы. Каждый тип находится на определённом уровне и связан с другими через [жёсткую иерархию](#issues-hierarchy) (как показано на изображении выше). | +| `issue_log.level` | [Глубина вложенности](#issues-hierarchy) проблемы. | +| `database_status` | Если в настройках задан параметр `verbose`, то поле `database_status` будет заполнено. Оно предоставляет сводку общего состояния базы данных и используется для быстрой оценки состояния базы данных и выявления серьёзных проблем на высоком уровне. [Пример](#example-verbose). Полную структуру ответа можно посмотреть в файле [ydb_monitoring.proto](https://github.com/ydb-platform/ydb/public/api/protos/ydb_monitoring.proto) в Git репозитории {{ ydb-short-name }}. | +| `location` | Содержит информацию о хосте, на котором был вызван сервис `HealthCheck`. | + +### Иерархия проблем {#issues-hierarchy} + +Эти проблемы можно организовать в иерархию с помощью полей `id` и `reason`, что помогает визуализировать, как проблемы в отдельном модуле влияют на состояние системы в целом. Все проблемы организованы в иерархию, где верхние уровни могут зависеть от вложенных: + +![cards_hierarchy](./_assets/hc_cards_hierarchy.png) + +Каждая проблема имеет уровень вложенности `level` — чем выше `level`, тем глубже проблема находится в иерархии. Проблемы одного и того же типа (поле `type`) всегда имеют одинаковый `level`, и их можно представить в виде иерархии. + +![issues_hierarchy](./_assets/hc_types_hierarchy.png) + +### Результат проверки базы данных {#selfcheck-result} + +Наиболее общий статус базы данных может принимать следующие значения: + +| Поле | Описание | +|:----|:----| +| `GOOD` | Проблем не обнаружено. | +| `DEGRADED` | Обнаружена деградация одной из систем базы данных, но база данных всё ещё функционирует (например, допустимая потеря диска). | +| `MAINTENANCE_REQUIRED` | Обнаружена значительная деградация, есть риск потери доступности, требуется обслуживание. | +| `EMERGENCY` | Обнаружена серьёзная проблема в базе данных с полной или частичной потерей доступности. | + +#### Статус проблемы {#issue-status} + +Статус (серьёзность) текущей проблемы: + +| Поле | Описание | +|:----|:----| +| `GREY` | Обнаружена деградация одной из систем базы данных, но база данных всё ещё функционирует (например, допустимая потеря диска). | +| `GREEN` | Проблем не обнаружено. | +| `BLUE` | Временная небольшая деградация, не влияющая на доступность базы данных. Ожидается переход системы в `GREEN`. | +| `YELLOW` | Небольшая проблема, нет рисков для доступности. Рекомендуется продолжать мониторинг проблемы. | +| `ORANGE` | Серьёзная проблема, мы в шаге от потери доступности. Может потребоваться обслуживание. | +| `RED` | Компонент неисправен или недоступен. | + +## Возможные проблемы {#issues} + +### DATABASE + +#### Database has multiple issues, Database has compute issues, Database has storage issues + +**Описание:** Зависит от нижележащих слоёв `COMPUTE` и `STORAGE`. Это самый общий статус базы данных. + +### STORAGE + +#### There are no storage pools + +**Описание:** Нет информации о пулах хранения. Скорее всего, пулы хранения не настроены. + +#### Storage degraded, Storage has no redundancy, Storage failed + +**Описание:** Зависит от нижележащего слоя `STORAGE_POOLS`. + +#### System tablet BSC didn't provide information + +**Описание:** Информация о распределённом хранилище недоступна. + +#### Storage usage over 75%, Storage usage over 85%, Storage usage over 90% + +**Описание:** Необходимо увеличить дисковое пространство. + +### STORAGE_POOL + +#### Pool degraded, Pool has no redundancy, Pool failed + +**Описание:** Зависит от нижележащего слоя `STORAGE_GROUP`. + +### STORAGE_GROUP + +#### Group has no vslots + +**Описание:** Эта ошибка не ожидается. Внутренняя ошибка. + +#### Group degraded + +**Описание:** В группе недоступно допустимое число дисков. +**Логика работы:** `HealthCheck` проверяет различные параметры (режим отказоустойчивости, количество отказавших дисков, статус дисков и т. д.) и в зависимости от этого устанавливает соответствующий статус группы. +**Действия при срабатывании:** В [YDB Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Groups` и `Degraded`, по известному `id` группы проверить доступность нод и дисков на нодах. + +#### Group has no redundancy + +**Описание:** Группа хранения потеряла избыточность. Ещё один сбой в работе диска может привести к потере группы. +**Логика работы:** `HealthCheck` проверяет различные параметры (режим отказоустойчивости, количество отказавших дисков, статус дисков и т. д.) и в зависимости от этого устанавливает соответствующий статус группы. +**Действия при срабатывании:** В [YDB Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Groups` и `Degraded`, по известному `id` группы проверить доступность нод и дисков на нодах. + +#### Group failed + +**Описание:** Группа хранения потеряла целостность и неработоспособна. Данные недоступны. +**Логика работы:** `HealthCheck` проверяет различные параметры (режим отказоустойчивости, количество отказавших дисков, статус дисков и т. д.) и в зависимости от этого устанавливает соответствующий статус группы. +**Действия при срабатывании:** В [YDB Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Groups` и `Degraded`, по известному `id` группы проверить доступность нод и дисков на нодах. + +### VDISK + +#### System tablet BSC didn't provide known status + +**Описание:** Эта ошибка не ожидается. Внутренняя ошибка. + +#### VDisk is not available + +**Описание:** Виртуальный диск отсутствует. +**Действия при срабатывании:** В [YDB Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Groups` и `Degraded`. По связанному issue `STORAGE_GROUP` можно узнать `id` группы. Навести на нужный vdisk — будет видно, на какой ноде проблема. Проверить доступность нод и дисков на нодах. + +#### VDisk is being initialized + +**Описание:** Инициализация виртуального диска в процессе. +**Действия при срабатывании:** В [Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Groups` и `Degraded`. По связанному issue `STORAGE_GROUP` можно узнать `id` группы. Навести на нужный vdisk — будет видно, на какой ноде проблема. Проверить доступность нод и дисков на нодах. + +#### Replication in progress + +**Описание:** Диск в процессе репликации, но может принимать запросы. +**Действия при срабатывании:** В [Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Groups` и `Degraded`. По связанному issue `STORAGE_GROUP` можно узнать `id` группы. Навести на нужный vdisk — будет видно, на какой ноде проблема. Проверить доступность нод и дисков на нодах. + +#### VDisk have space issue + +**Описание:** Зависит от нижележащего слоя `PDISK`. + +### PDISK + +#### Unknown PDisk state + +**Описание:** `HealthCheck` не может определить состояние PDisk. Внутренняя ошибка. + +#### PDisk state is ... + +**Описание:** Сообщает состояние физического диска. +**Действия при срабатывании:** В [Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Nodes` и `Degraded`. По известным `id` ноды и pDisk проверить доступность нод и дисков на нодах. + +#### Available size is less than 12%, Available size is less than 9%, Available size is less than 6% + +**Описание:** На физическом диске заканчивается свободное место. +**Действия при срабатывании:** В [Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Nodes` и `Out of Space`, по известным `id` ноды и PDisk просмотреть доступное место. + +#### PDisk is not available + +**Описание:** Физический диск отсутствует. +**Действия при срабатывании:** В [Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на страницу базы данных, выбрать вкладку `Storage`, установить фильтры `Nodes` и `Degraded`, по известным `id` ноды и PDisk проверить доступность нод и дисков на нодах. + +### STORAGE_NODE + +#### Storage node is not available + +**Описание:** Стореджовая нода отсутствует. Эта информация помогает при диагностике верхнего слоя `PDISK`. + +### COMPUTE + +#### There are no compute nodes + +**Описание:** В базе данных отсутствуют ноды для запуска таблеток. Невозможно определить уровень `COMPUTE_NODE` ниже. + +#### Compute has issues with system tablets + +**Описание:** Зависит от нижележащего слоя `SYSTEM_TABLET`. + +#### Some nodes are restarting too often + +**Описание:** Зависит от нижележащего слоя `NODE_UPTIME`. + +#### Compute is overloaded + +**Описание:** Зависит от нижележащего слоя `COMPUTE_POOL`. + +#### Compute quota usage + +**Описание:** Зависит от нижележащего слоя `COMPUTE_QUOTA`. + +#### Compute has issues with tablets + +**Описание:** Зависит от нижележащего слоя `TABLET`. + +### COMPUTE_QUOTA + +#### Paths quota usage is over than 90%, Paths quota usage is over than 99%, Paths quota exhausted, Shards quota usage is over than 90%, Shards quota usage is over than 99%, Shards quota exhausted + +**Описание:** Квоты исчерпаны. +**Действия при срабатывании:** Проверить количество объектов (таблицы, топики) в базе данных, удалить лишние. + +### SYSTEM_TABLET + +#### System tablet is unresponsive, System tablet response time over 1000ms, System tablet response time over 5000ms + +**Описание:** Системная таблетка не отвечает или отвечает с задержкой. +**Действия при срабатывании:** В [Embedded UI](../embedded-ui/ydb-monitoring.md) на вкладке `Storage` установить фильтр `Nodes`. Проверить `Uptime` нод и их статус. Если `Uptime` небольшой, проверить по логам причины рестарта нод. + +### TABLET + +#### Tablets are restarting too often + +**Описание:** Таблетки слишком часто перезапускаются. +**Действия при срабатывании:** В [Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на вкладку `Nodes`. Проверить `Uptime` нод и их статус. Если `Uptime` небольшой, необходимо проверить логи для определения причин частых рестартов нод. + +#### Tablets are dead, Followers are dead + +**Описание:** Таблетки не запущены (или не могут быть запущены). +**Действия при срабатывании:** В [Embedded UI](../embedded-ui/ydb-monitoring.md) перейти на вкладку `Nodes`. Проверить `Uptime` нод и их статус. Если `Uptime` небольшой, необходимо проверить логи для определения причин рестарта нод. + +### LOAD_AVERAGE + +#### LoadAverage above 100% + +**Описание:** Физический хост перегружен ([Load](https://ru.wikipedia.org/wiki/%D0%A1%D1%80%D0%B5%D0%B4%D0%BD%D1%8F%D1%8F_%D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B0)) . Это указывает на то, что система работает на пределе, скорее всего, из-за большого количества процессов, ожидающих операций ввода-вывода. + +**Логика работы:** +Информация о нагрузке: + +- Источник: `/proc/loadavg` +- Информация о логических ядрах: + + - Основной источник: `/sys/fs/cgroup/cpu.max` + - Дополнительный источник: `/sys/fs/cgroup/cpu/cpu.cfs_quota_us`, `/sys/fs/cgroup/cpu/cpu.cfs_period_us` + +- Количество ядер вычисляется путём деления квоты на период (`quota / period`). + +**Действия при срабатывании:** Проверить загруженность нод по CPU. + +### COMPUTE_POOL + +#### Pool usage is over than 90%, Pool usage is over than 95%, Pool usage is over than 99% + +**Описание:** Один из CPU-пулов перегружен. +**Действия при срабатывании:** Добавить ядра в конфигурацию акторной системы соответствующего CPU-пула. + +### NODE_UPTIME + +#### The number of node restarts has increased + +**Описание:** Количество рестартов ноды превысило порог. По умолчанию это 10 рестартов в час. +**Действия при срабатывании:** Проверить причины рестарта процесса по логам. + +#### Node is restarting too often + +**Описание:** Узлы слишком часто перезапускаются. По умолчанию это 30 рестартов в час. +**Действия при срабатывании:** Проверить причины рестарта процесса по логам. + +### NODES_TIME_DIFFERENCE + +#### Node is ... ms behind peer [id], Node is ... ms ahead of peer [id] + +**Описание:** Расхождение времени на узлах, что может приводить к проблемам с координацией распределённых транзакций. Проблема начинает проявляться при расхождении в 5 ms. +**Действия при срабатывании:** Проверить расхождение системного времени между нодами, перечисленными в алерте, и проверить работу процесса синхронизации времени. + +## Примеры ответа {#examples} + +Самый короткий ответ сервиса будет выглядеть следующим образом. Он возвращается, если с базой данных всё в порядке: + +```json +{ + "self_check_result": "GOOD" +} +``` + +### Пример verbose {#example-verbose} + +Ответ `GOOD` при использовании параметра `verbose`: + +```json +{ + "self_check_result": "GOOD", + "database_status": [ + { + "name": "/amy/db", + "overall": "GREEN", + "storage": { + "overall": "GREEN", + "pools": [ + { + "id": "/amy/db:ssdencrypted", + "overall": "GREEN", + "groups": [ + { + "id": "2181038132", + "overall": "GREEN", + "vdisks": [ + { + "id": "9-1-1010", + "overall": "GREEN", + "pdisk": { + "id": "9-1", + "overall": "GREEN" + } + }, + { + "id": "11-1004-1009", + "overall": "GREEN", + "pdisk": { + "id": "11-1004", + "overall": "GREEN" + } + }, + { + "id": "10-1003-1011", + "overall": "GREEN", + "pdisk": { + "id": "10-1003", + "overall": "GREEN" + } + }, + { + "id": "8-1005-1010", + "overall": "GREEN", + "pdisk": { + "id": "8-1005", + "overall": "GREEN" + } + }, + { + "id": "7-1-1008", + "overall": "GREEN", + "pdisk": { + "id": "7-1", + "overall": "GREEN" + } + }, + { + "id": "6-1-1007", + "overall": "GREEN", + "pdisk": { + "id": "6-1", + "overall": "GREEN" + } + }, + { + "id": "4-1005-1010", + "overall": "GREEN", + "pdisk": { + "id": "4-1005", + "overall": "GREEN" + } + }, + { + "id": "2-1003-1013", + "overall": "GREEN", + "pdisk": { + "id": "2-1003", + "overall": "GREEN" + } + }, + { + "id": "1-1-1008", + "overall": "GREEN", + "pdisk": { + "id": "1-1", + "overall": "GREEN" + } + } + ] + } + ] + } + ] + }, + "compute": { + "overall": "GREEN", + "nodes": [ + { + "id": "50073", + "overall": "GREEN", + "pools": [ + { + "overall": "GREEN", + "name": "System", + "usage": 0.000405479 + }, + { + "overall": "GREEN", + "name": "User", + "usage": 0.00265229 + }, + { + "overall": "GREEN", + "name": "Batch", + "usage": 0.000347933 + }, + { + "overall": "GREEN", + "name": "IO", + "usage": 0.000312022 + }, + { + "overall": "GREEN", + "name": "IC", + "usage": 0.000945925 + } + ], + "load": { + "overall": "GREEN", + "load": 0.2, + "cores": 4 + } + }, + { + "id": "50074", + "overall": "GREEN", + "pools": [ + { + "overall": "GREEN", + "name": "System", + "usage": 0.000619053 + }, + { + "overall": "GREEN", + "name": "User", + "usage": 0.00463859 + }, + { + "overall": "GREEN", + "name": "Batch", + "usage": 0.000596071 + }, + { + "overall": "GREEN", + "name": "IO", + "usage": 0.0006241 + }, + { + "overall": "GREEN", + "name": "IC", + "usage": 0.00218465 + } + ], + "load": { + "overall": "GREEN", + "load": 0.08, + "cores": 4 + } + }, + { + "id": "50075", + "overall": "GREEN", + "pools": [ + { + "overall": "GREEN", + "name": "System", + "usage": 0.000579126 + }, + { + "overall": "GREEN", + "name": "User", + "usage": 0.00344293 + }, + { + "overall": "GREEN", + "name": "Batch", + "usage": 0.000592347 + }, + { + "overall": "GREEN", + "name": "IO", + "usage": 0.000525747 + }, + { + "overall": "GREEN", + "name": "IC", + "usage": 0.00174265 + } + ], + "load": { + "overall": "GREEN", + "load": 0.26, + "cores": 4 + } + } + ], + "tablets": [ + { + "overall": "GREEN", + "type": "SchemeShard", + "state": "GOOD", + "count": 1 + }, + { + "overall": "GREEN", + "type": "SysViewProcessor", + "state": "GOOD", + "count": 1 + }, + { + "overall": "GREEN", + "type": "Coordinator", + "state": "GOOD", + "count": 3 + }, + { + "overall": "GREEN", + "type": "Mediator", + "state": "GOOD", + "count": 3 + }, + { + "overall": "GREEN", + "type": "Hive", + "state": "GOOD", + "count": 1 + } + ] + } + } + ] +} +``` + +### Пример EMERGENCY {#example-emergency} + +Ответ в случаи проблем может выглядеть так: + +```json +{ + "self_check_result": "EMERGENCY", + "issue_log": [ + { + "id": "RED-27c3-70fb", + "status": "RED", + "message": "Database has multiple issues", + "location": { + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-27c3-4e47", + "RED-27c3-53b5", + "YELLOW-27c3-5321" + ], + "type": "DATABASE", + "level": 1 + }, + { + "id": "RED-27c3-4e47", + "status": "RED", + "message": "Compute has issues with system tablets", + "location": { + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-27c3-c138-BSController" + ], + "type": "COMPUTE", + "level": 2 + }, + { + "id": "RED-27c3-c138-BSController", + "status": "RED", + "message": "System tablet is unresponsive", + "location": { + "compute": { + "tablet": { + "type": "BSController", + "id": [ + "72057594037989391" + ] + } + }, + "database": { + "name": "/slice" + } + }, + "type": "SYSTEM_TABLET", + "level": 3 + }, + { + "id": "RED-27c3-53b5", + "status": "RED", + "message": "System tablet BSC didn't provide information", + "location": { + "database": { + "name": "/slice" + } + }, + "type": "STORAGE", + "level": 2 + }, + { + "id": "YELLOW-27c3-5321", + "status": "YELLOW", + "message": "Storage degraded", + "location": { + "database": { + "name": "/slice" + } + }, + "reason": [ + "YELLOW-27c3-595f-8d1d" + ], + "type": "STORAGE", + "level": 2 + }, + { + "id": "YELLOW-27c3-595f-8d1d", + "status": "YELLOW", + "message": "Pool degraded", + "location": { + "storage": { + "pool": { + "name": "static" + } + }, + "database": { + "name": "/slice" + } + }, + "reason": [ + "YELLOW-27c3-ef3e-0" + ], + "type": "STORAGE_POOL", + "level": 3 + }, + { + "id": "RED-84d8-3-3-1", + "status": "RED", + "message": "PDisk is not available", + "location": { + "storage": { + "node": { + "id": 3, + "host": "man0-0026.ydb-dev.nemax.nebiuscloud.net", + "port": 19001 + }, + "pool": { + "group": { + "vdisk": { + "pdisk": [ + { + "id": "3-1", + "path": "/dev/disk/by-partlabel/NVMEKIKIMR01" + } + ] + } + } + } + } + }, + "type": "PDISK", + "level": 6 + }, + { + "id": "RED-27c3-4847-3-0-1-0-2-0", + "status": "RED", + "message": "VDisk is not available", + "location": { + "storage": { + "node": { + "id": 3, + "host": "man0-0026.ydb-dev.nemax.nebiuscloud.net", + "port": 19001 + }, + "pool": { + "name": "static", + "group": { + "vdisk": { + "id": [ + "0-1-0-2-0" + ] + } + } + } + }, + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-84d8-3-3-1" + ], + "type": "VDISK", + "level": 5 + }, + { + "id": "YELLOW-27c3-ef3e-0", + "status": "YELLOW", + "message": "Group degraded", + "location": { + "storage": { + "pool": { + "name": "static", + "group": { + "id": [ + "0" + ] + } + } + }, + "database": { + "name": "/slice" + } + }, + "reason": [ + "RED-27c3-4847-3-0-1-0-2-0" + ], + "type": "STORAGE_GROUP", + "level": 4 + } + ], + "location": { + "id": 5, + "host": "man0-0028.ydb-dev.nemax.nebiuscloud.net", + "port": 19001 + } +} +```