This article is applicable to the scenario of independent deployment of obdiag. It can be executed with one click to retrieve the troubleshooting information required for troubleshooting problems in unspecified scenarios, solving the pain point of difficulty in retrieving distributed node information.
Instructions for use
obdiag gather scene run --scene=observer.unknown [options]
The options are explained below:
Option name |
Is it required |
Data type |
Default value |
Description |
|---|---|---|---|---|
| --scene | Yes | string | Default is empty | Scene name, you can use obdiag gather scene list to see which scenes the current version supports |
| --from | No | string | Default is empty | The start time of log collection, the format is: yyyy-mm-dd hh:mm:ss.
ExplanationIf the obdiag used is a version before V2.0.0, there is no need to add quotation marks when configuring this option, otherwise an error will be reported. V2.0.0 and later versions no longer limit whether to include quotes when configuring this option. |
| --to | No | string | Default is empty | The end time of log collection, the format is: yyyy-mm-dd hh:mm:ss.
ExplanationIf the obdiag used is a version before V2.0.0, there is no need to add quotation marks when configuring this option, otherwise an error will be reported. V2.0.0 and later versions no longer limit whether to include quotes when configuring this option. |
| --since | No | string | Default is empty | The log collects the most recent period of time in the format: <n> <m|h|d>, where n represents the time number to be entered, m represents the minute, h represents the hour, and d represents the day. For example, 30m represents collecting the logs of the last 30 minutes. |
| --store_dir | No | string | Defaults to the current path where the command is executed | The local path where the results are stored. |
| --temp_dir | No | string | /tmp |
The temporary file storage directory generated by the remote node during the log collection process. |
| --redact | No | string | Default is empty | Select the observer log desensitization rule, for example, it can be configured as all_sql. When using multiple rules, use English commas (,) to separate them. To write the rules, refer to the introduction of this article [Preparing desensitization rules] (../100.normal/101.gather_log.md). |
| -c | No | string | ~/.obdiag/config.yml |
Configuration file path. |
| --inner_config | No | string | Default is empty | obdiag's own configuration. |
| --config | No | string | Default is empty | Configuration of the cluster to be diagnosed by obdiag, fixed style: --config key1=value1 --config key2=value2.
ExplanationThe parameters that support configuration through this option can be found in obdiag configuration. |
| --config_password | No | string | Default is empty | obdiag When using an encrypted configuration file, you need to pass in the corresponding password through this option.
ExplanationFor details, see Configuration file encryption. |
Usage example
Method 1: Use without configuration file (out of the box)
# Unspecified scenario: collect last 30m by default when no extra args
obdiag gather scene run --scene=observer.unknown \
--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 --since for unspecified-scenario collection time window
obdiag gather scene run --scene=observer.unknown --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 --from/--to for unspecified-scenario time range
obdiag gather scene run --scene=observer.unknown --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 with configuration file
You need to ensure that the login information of the node to be collected has been configured in the obdiag configuration file config.yml. For related detailed configuration introduction, see obdiag configuration.
# Unspecified scenario: collect last 30m by default when no extra args
obdiag gather scene run --scene=observer.unknown
# Use --since for unspecified-scenario collection time window
obdiag gather scene run --scene=observer.unknown --since 30m
# Use --from/--to for unspecified-scenario time range
obdiag gather scene run --scene=observer.unknown --from "2022-06-30 16:25:00" --to "2022-06-30 18:30:00"
Interpretation of results
After the command is executed, a folder will be generated in the specified directory. The folder looks like: obdiag_gather_pack_20240808105846
# tree
.
├── ob_log_remote_xx.xx.xx.xx_20240808201458_20240808204558.zip # Node logs
├── result_summary.txt
├── shell_result.txt # Shell commands/output needed for troubleshooting
├── sql_result.txt # SQL info for unspecified-scenario troubleshooting
└── sysstat_xx.xx.xx.xx_20240808204521.zip # Host stats included for unspecified-scenario troubleshooting
Practical cases
Case: A user encounters an unspecified scenario problem and needs to troubleshoot. Directly execute the following command to package the information required for diagnosis and send it to the community forum or frontline support staff.
obdiag gather scene run --scene=observer.unknown \
--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
