OceanBase
English日本語简体中文
Docs Home
Products
Integrations
Release Notes

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Databases

OceanBase DatabaseOceanBase Cloud OceanBase Best Practices

Connectors and Middleware

OceanBase Database Proxy OceanBase Connector/C OceanBase Connector/J OceanBase Connector/ODBC OceanBase Connector/NETOceanBase Command-Line Client

Tools

OceanBase Cloud PlatformOceanBase Migration ServiceOceanBase Developer CenterOceanBase Migration AssessmentOceanBase Admin ToolOceanBase Loader and DumperOceanBase DeployerKubernetes operator for OceanBaseOceanBase Diagnostic Tool OceanBase Binlog Service
OceanBase DatabaseOceanBase Cloud ToolsConnectors and MiddlewareLifecycle Support Policy

OceanBase Diagnostic Tool

V3.2.0
  • Overview
  • Install obdiag
  • Configure obdiag
  • One-click Cluster Inspection
    • Use obdiag to inspect an OceanBase cluster
    • Inspection metrics
  • One-click Information Collection
    • One-click General Information Collection
      • obdiag gather log
      • obdiag gather sysstat
      • obdiag gather plan_monitor
      • obdiag gather stack
      • obdiag gather perf
      • obdiag gather ash
      • obdiag gather tabledump
      • obdiag gather parameter
      • obdiag gather variable
      • obdiag gather clog/obdiag gather slog
      • obdiag gather obproxy_log
      • obdiag gather all
    • One-click Scenario-based Information Collection
      • Overview
      • observer.base
      • observer.backup
      • observer.backup_clean
      • observer.clog_disk_full
      • observer.cluster_down
      • observer.compaction
      • observer.cpu_high
      • observer.delay_of_primary_and_backup
      • observer.io
      • observer.log_archive
      • observer.long_transaction
      • observer.memory
      • observer.perf_sql
      • observer.px_collect_log
      • observer.recovery
      • observer.restart
      • observer.rootservice_switch
      • observer.suspend_transaction
      • observer.unit_data_imbalance
      • observer.perf_sql
      • observer.topsql
      • other.application_error
      • obproxy.restart
      • observer.unknown
  • One-click Diagnostic Analysis
    • obdiag analyze log
    • obdiag analyze flt_trace
    • obdiag analyze parameter default
    • obdiag analyze parameter diff
    • obdiag analyze variable diff
    • obdiag analyze index_space
    • obdiag analyze memory
    • obdiag analyze queue
  • One-click Root Cause Analysis
    • Use obdiag for root cause analysis
    • disconnection
    • major_hold
    • lock_conflict
    • ddl_disk_full
    • clog_disk_full
    • log_error
    • ddl_failure
    • index_ddl_error
    • transaction_disconnection
    • transaction_execute_timeout
    • transaction_not_ending
    • transaction_other_error
    • transaction_rollback
    • transaction_wait_timeout
    • oms_full_trans
  • One-click Cluster Display
    • Overview
    • Basic information of a cluster
    • Information about nodes in a cluster
    • Information about units in a cluster
    • Information about zones in a cluster
    • RootService information of a cluster
    • Information about tenants in a cluster
    • Information about events in a cluster
    • Information about locks in a cluster
    • Information about top SQL statements in a cluster
    • Information about slow SQL statements in a cluster
    • Information about tables in a cluster
    • Information about the process list in a tenant
    • Information about the execution plan of an SQL statement
    • Disk usage of a database
    • Disk usage of the specified table in a database
    • Information about all tenants in a cluster
    • Information about CPU utilization of nodes in a cluster
    • Internal table names fuzzy matched with the specified keyword
    • Information about leaders in a cluster
    • Information about locks on a table
    • Information about long-running transactions in a cluster
    • Information about operators in the actually executed plan
    • Information about the memory of all tenants
    • Information about statistics on real-time sessions of the process list
    • Information about the storage method of tables and indexes
    • Information about column NDVs of a table
    • Information about table indexes
  • Upgrade obdiag by using add-on files
  • Upgrade and uninstall obdiag
  • Telemetry Mode
  • FAQ
  • Release Notes
    • obdiag V3.2.0
    • obdiag V3.1.0
    • obdiag V3.0.0
    • obdiag V2.6.0
    • obdiag V2.5.0
    • obdiag V2.4.0
    • obdiag V2.3.0
    • obdiag V2.2.0
    • obdiag V2.1.0
    • obdiag V2.0.0
    • obdiag V1.6.2
    • obdiag V1.6.1
    • obdiag V1.6.0
    • obdiag V1.5.2
    • obdiag V1.5.1
    • obdiag V1.5.0
    • obdiag V1.4.0
    • obdiag V1.3.0

Download PDF

Document Feedback
  1. Documentation Center
  2. OceanBase Diagnostic Tool
  3. V3.2.0

Overview

Last Updated:2026-09-04 08:22:11

Prerequisites
View supported scenarios
Use the obdiag gather scene run command
Examples
Method 1: Use the command out-of-the-box without a configuration file
Method 2: Use the command with a configuration file
Tutorial for writing a task
Preparations
Write a task

If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can run obdiag gather commands to collect diagnostic information of OceanBase Database. You can run the obdiag gather scene run command to collect the information required for troubleshooting specific issues. These commands help address the pain point in collecting information on distributed nodes.

Prerequisites

Make sure that you have configured the login information of the target nodes in the config.yml configuration file of obdiag. For more information, see Configure obdiag.

View supported scenarios

obdiag gather scene list

Use the obdiag gather scene run command

obdiag gather scene run --scene={SceneName}

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 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.

Note

If 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.

Note

If 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 <n> <m|h|d> format, 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.
--env No string Empty Additional parameters required in specific scenarios.
--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.

Note

For information about the parameters supported by this option, see Configure obdiag.

Note

If you do not specify the store_dir option, the collected information will be stored in the gather_pack_xxxx folder in the current directory.

Examples

Method 1: Use the command out-of-the-box without a configuration file

obdiag gather scene run --scene={SceneName} \
    --config db_host=xx.xx.xx.xx \
    --config db_port=xxxx \
    --config tenant_sys.user=root@sys \
    --config tenant_sys.password=*** \
    --config obcluster.servers.nodes[0].ip=xx.xx.xx.1 \
    --config obcluster.servers.nodes[1].ip=xx.xx.xx.xx.2 \
    --config obcluster.servers.nodes[2].ip=xx.xx.xx.xx.3 \
    --config obcluster.servers.global.ssh_username=test \
    --config obcluster.servers.global.ssh_password=****** \
    --config obcluster.servers.global.home_path=/home/admin/oceanbase \
    --config obproxy.servers.nodes[0].ip=xx.xx.xx.3 \
    --config obproxy.servers.nodes[1].ip=xx.xx.xx.xx.4 \
    --config obproxy.servers.global.ssh_username=test \
    --config obproxy.servers.global.ssh_password=****** \
    --config obproxy.servers.global.home_path=/home/admin/obproxy

Method 2: Use the command with a configuration file

Make sure that you have configured the login information of the target nodes in the config.yml configuration file of obdiag. For more information, see Configure obdiag.

obdiag gather scene run --scene={SceneName}

Tutorial for writing a task

A task is a specific scenario. obdiag runs a task based on the dedicated script file in the YAML format.

Preparations

Before you write the script file of a task, you must specify the path of the file.

The file must be stored in the directory specified by the gather.scenes_base_path parameter in the inner_config.yml configuration file in the /usr/local/oceanbase-diagnostic-tool/conf/ directory. Check whether the task falls into an existing category in the directory. If not, create a folder to declare the category.

Here is an example:

# Go to ${gather.scenes_base_path} and create a sample file test.yaml for testing the observer process.
cd ~/.obdiag/gather/tasks/observer
touch test.yaml

Now you are prepared.

Write a task

To write a task is to edit the test.yaml file.

# Declare the purpose of the task.

info: "for test"

Pay attention to the details when you write the task.

Task writing description

The task script is a list that declares the steps to be executed in scenario-based collection. The steps may vary based on the version.

An element of a task involves the following parameters.

Parameter
Required
Description
Data type
version No The OceanBase Database versions that the script is compatible with. An example is provided below the table. The value is a left-open right-closed range with complete version numbers in the form of a string, such as [3.1.1,3.2.0]. A version number contains three digits for OceanBase Database V3.x or four digits for OceanBase Database V4.x.
steps Yes The steps to be executed. The steps are in a list structure.

Here is an example:

info: testinfo
task:
  - version: "[3.1.0,3.2.4]"
    steps:
     {steps_object}
  - version: [4.2.0.0,4.3.0.0]
    steps:
     {steps_object}

steps is a list of multiple execution processes.

An element of steps is a single step that involves the following parameters.

Parameter
Required
Description
type Yes The type of the execution step. Valid values: ssh, sql, log, obproxy_log, and sysstat. More types will be supported in later versions.
{ssh/sql/log/obproxy_log/sysstat} Yes The parameter for the selected type, which depends on the logic description of the execution type in the code. Supported execution steps are described in the following sections.

In the following examples, step: serves only as a mark and has no actual meaning.

ssh

Remotely execute the instruction and obtain the corresponding return value.

step:
  type: ssh
  ssh: wc -l /proc/${task_OBServer_pid}/maps | awk '{print $1}'
  global: false # This field specifies whether to execute a step only on a single node or on all nodes. The value "true" specifies to execute the step only on the first node. The value "false" specifies to execute the step on each node.
sql

Execute an SQL statement and obtain the corresponding value.

step:
 type: sql
 sql: select tenant_name from oceanbase.__all_tenant;
 global: false
log

Collect logs of OceanBase Database.

step:
 type: log
 grep: "" # The field for filtering logs.
 global: false
obproxy_log

Collect logs of OceanBase Database Proxy (ODP).

step:
 type: obproxy_log
 grep: "" # The field for filtering logs.
 global: false
sysstat

Collect host information.

step:
 type: sysstat
 sysstat: ""
 global: false

Note

The global field specifies whether to execute a step only on a single node or on all nodes. The value true specifies to execute the step only on the first node. The value false specifies to execute the step on each node.

Previous topic

obdiag gather all
Last

Next topic

observer.base
Next
on this page
Prerequisites
View supported scenarios
Use the obdiag gather scene run command
Examples
Method 1: Use the command out-of-the-box without a configuration file
Method 2: Use the command with a configuration file
Tutorial for writing a task
Preparations
Write a task