If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can specify the observer.cpu_high scenario in the obdiag gather scene run command to collect the information required for analyzing high CPU utilization. The command helps address the pain point in collecting information on distributed nodes.
Syntax
obdiag gather scene run --scene=observer.cpu_high [options]
The following table describes the options.
| Option | Required? | Data type | Default value | Description |
|---|---|---|---|---|
| --scene | Yes | string | Empty | The name of the scenario. You can run the obd obdiag gather scene list command to view the scenarios supported by the current version. |
| --from | No | string | Empty | The start time of log collection in the yyyy-mm-dd hh:mm:ss format.
NoteIf the obdiag version is earlier than V.2.0.0, do not enclose the parameter value in quotation marks. Otherwise, an error is returned. This limitation does not apply to V2.0.0 or later. |
| --to | No | string | Empty | The end time of log collection in the yyyy-mm-dd hh:mm:ss format.
NoteIf the obdiag version is earlier than V.2.0.0, do not enclose the parameter value in quotation marks. Otherwise, an error is returned. This limitation does not apply to V2.0.0 or later. |
| --since | No | string | Empty | The most recent period of time for log collection, in the format of <n> <m|h|d>, where n specifies the time value, m represents "minute", h represents "hour", and d represents "day". For example, 30m specifies to collect logs of the last 30 minutes. |
| --store_dir | No | string | The current path where the command is executed | The local path where the results are stored. |
| --temp_dir | No | string | /tmp |
The directory where temporary files generated by the remote node during log collection are stored. |
| -c | No | string | ~/.obdiag/config.yml |
The path of the configuration file. |
| --inner_config | No | string | Empty | The configurations of obdiag. |
| --config | No | string | Empty | The configurations of the cluster diagnosed by obdiag, in the format of --config key1=value1 --config key2=value2.
NoteFor information about the parameters supported by this option, see Configure obdiag. |
Examples
Method 1: Use the command out-of-the-box without a configuration file
# Collect information for high CPU utilization. If you do not specify any other options, the command collects the information of the last 30 minutes.
obdiag gather scene run --scene=observer.cpu_high \
--config db_host=xx.xx.xx.xx \
--config db_port=xxxx \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=*** \
--config obcluster.servers.global.ssh_username=test \
--config obcluster.servers.global.ssh_password=****** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
# Use the `--since` option to specify the time range of information to be collected for high CPU utilization.
obdiag gather scene run --scene=observer.cpu_high --since 30m \
--config db_host=xx.xx.xx.xx \
--config db_port=xxxx \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=*** \
--config obcluster.servers.global.ssh_username=test \
--config obcluster.servers.global.ssh_password=****** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
# Use the `--from` and `--to` options to specify the time range of high CPU utilization.
obdiag gather scene run --scene=observer.cpu_high --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00" \
--config db_host=xx.xx.xx.xx \
--config db_port=xxxx \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=*** \
--config obcluster.servers.global.ssh_username=test \
--config obcluster.servers.global.ssh_password=****** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase
Method 2: Use the command with a configuration file
Before you run the command, make sure that you have configured the logon information of the target nodes in the config.yml configuration file of obdiag. For more information, see Configure obdiag.
# Collect information for high CPU utilization. If you do not specify any other options, the command collects the information of the last 30 minutes.
obdiag gather scene run --scene=observer.cpu_high
# Use the `--since` option to specify the time range of information to be collected for high CPU utilization.
obdiag gather scene run --scene=observer.cpu_high --since 30m
# Use the `--from` and `--to` options to specify the time range of high CPU utilization.
obdiag gather scene run --scene=observer.cpu_high --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00"
Results
The command generates a folder in the specified directory. A sample folder name is obdiag_gather_pack_20240808105846.
#tree
.
├── current_clocksource_xx_xx_xx_xx_result.txt
├── ob_log_remote_xx.xx.xx.xx.xx_20240808234345_20240809001445.zip # The logs of OBServer nodes.
├── obstack2_xx.xx.xx.xx.xx_20240809001230.zip # The stack information of OBServer nodes.
├── perf_xx.xx.xx.xx.xx_20240809001236.zip # The performance information of OBServer nodes.
├── result_summary.txt
└── sql_result.txt # The SQL statement execution results required for analyzing high CPU utilization.
For more information, see Interpret the perf Information Collected by obdiag.
Cases
When CPU utilization is high, you can run the following command to collect the information required for diagnostics. Then, you can post the information on the OceanBase community forum or send it to OceanBase Technical Support.
obdiag gather scene run --scene=observer.cpu_high \
--config db_host=xx.xx.xx.xx \
--config db_port=xxxx \
--config tenant_sys.user=root@sys \
--config tenant_sys.password=*** \
--config obcluster.servers.global.ssh_username=test \
--config obcluster.servers.global.ssh_password=****** \
--config obcluster.servers.global.home_path=/home/admin/oceanbase