OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

A unified distributed database ready for your transactional, analytical, and AI workloads.

DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Diagnostic Tool

V1.5.0

  • Overview
  • Install obdiag
  • Configure obdiag
  • Clustor monitor
    • Use obdiag to inspect an OceanBase cluster
    • Inspection metrics
  • Use obdiag to collect information
  • Use obdiag for diagnostic analysis
  • Telemetry mode
  • FAQ
  • Relase note
    • obdiag V1.5.0
    • obdiag V1.4.0
    • obdiag V1.3.0

Download PDF

Overview Install obdiag Configure obdiag Use obdiag to inspect an OceanBase cluster Inspection metrics Use obdiag to collect information Use obdiag for diagnostic analysis Telemetry mode FAQ obdiag V1.5.0 obdiag V1.4.0 obdiag V1.3.0
OceanBase logo

The Unified Distributed Database for the AI Era.

Follow Us
Products
OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
Resources
DocsBlogLive DemosTraining & Certification
Company
About OceanBaseTrust CenterLegalPartnerContact Us
Follow Us

© OceanBase 2026. All rights reserved

Cloud Service AgreementPrivacy PolicySecurity
Contact Us
Document Feedback
  1. Documentation Center
  2. OceanBase Diagnostic Tool
  3. V1.5.0
iconOceanBase Diagnostic Tool
V 1.5.0
  • V 3.3.0
  • V 3.2.0
  • V 3.1.0
  • V 3.0.0
  • V 2.6.0
  • V 2.5.0
  • V 2.4.0
  • V 2.3.0
  • V 1.5.0
  • V 1.4.0

Use obdiag to inspect an OceanBase cluster

Last Updated:2026-04-13 09:12:24  Updated
share
What is on this page
Prerequisites
check commands
Syntax
Tutorial for writing a task
Preparations
Write the task script
Manually update tasks

folded

share

If OceanBase Diagnostic Tool (obdiag) is independently deployed, you can use obdiag check commands to inspect the status of an OceanBase cluster. The inspection process analyzes the cluster from perspectives of the system kernel parameters and internal tables, identifies the causes of existing or possible exceptions, and provides O&M suggestions.

Prerequisites

You have installed obdiag. For more information, see Install obdiag.

check commands

Syntax

obdiag check [options]

The following table describes the options.

Option Required? Data type Default value Description
--cases No String `` The name of the collection of OBServer inspection items to be executed. If this option is not specified, all tasks are executed.
--obproxy_cases No String `` The name of the collection of OceanBase Database Proxy (ODP) inspection items to be executed. If this option is not specified, all tasks are executed.
-c No String ~/.obdiag/config.yml The path of the configuration file.

Here is an example:

obdiag check --cases=test

'cat ./check_report/check_report_2023-10-30-16:15:52.table', export type is table
For more details, please run cmd 'cat ./check_report/check_report_2023-10-30-16:15:52.table'
If you want to view detailed obdiag logs, please run:'obdiag display-trace --trace_id a7674ecb-0d99-36fe-b584-3b707b4647bc'

Tutorial for writing a task

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

The script file of a task contains a declaration at the beginning, which helps you implement professional inspections on an OceanBase cluster.

Preparations

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

The file must be saved in the directory specified by the CHECK.tasks_base_path parameter in the config.yml configuration file. 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 ${CHECK.tasks_base_path}/observer, create a folder named `test`, and then create a sample task script file named `test.yaml`.
cd ~/.obdiag/tasks/observer
mkdir test
cd test
touch test.yaml

Write the task script

The task script is a list that declares the steps to be executed in an inspection. You can specify steps for different versions of OceanBase Database, so the script can be used for inspections of OceanBase clusters of the specified versions.

Here is a sample task script:

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}

The following table describes the parameters.

Parameter Required? Description
info Yes The scenario to use the task script file. This information facilitates maintenance.
version No The OceanBase Database version that the script is compatible with. The value is a range with complete version numbers in the form of a string.
- The version number contains three digits for OceanBase Database V3.x, such as [3.1.1,3.2.0].
- The version number contains four digits for OceanBase Database V4.x, such as [4.1.0.0,4.2.0.0].
steps Yes The list of steps to be executed.

steps

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: get_system_parameter, ssh, and sql.
{parameter_name/ssh/sql} Yes The parameters for the selected type, which depend on the logic description of the execution type in the code.
result No An independent object that parses the operations to be performed after the current step ends, such as a verification result logic and the text information to be reported when the logic fails. For more information, see result & verify.

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

  • get_system_parameter
steps:
- type: get_system_parameter
  parameter_name: parameter
  result:
    set_value: servervm.max_map_count
  • ssh

Remotely execute the instruction and obtain the corresponding return value.

steps:
- type: ssh
  ssh: wc -l /proc/${task_OBServer_pid}/maps | awk '{print $1}'
  result:
    set_value: observerMaps
  • sql

Execute an SQL statement and obtain the corresponding value.

steps:
- type: sql
  sql: select tenant_name from oceanbase.table_name from where tenant_id=${taskTenantId};
  result:
    set_value: tenant_name
result & verify

This field is the main dependent field of the verify feature and is used to verify the task result.

The format of the result section is as follows:

result:
      set_value: {set_value}
      verify_type: {verify_type}
      report_type: {report_type}
      verify: {verify}
      err_msg: {err_msg}

The following table describes the parameters.

Parameter Required? Description
set_value No Evaluates the specified parameter as a variable applicable to the task after the task execution. For example, set_value: max_map_count.
verify_type No Specifies the verification method. The default value is base, which indicates to verify the result by using the expression specified by the verify parameter. The output is true or false. To reduce your coding workload, obdiag provides multiple types of verification methods.
verify No Verifies whether the execution result meets expectations based on the specified verification type. If not, the message specified by the err_msg parameter is returned.
report_type No The alert level returned if the verify parameter returns false. The default alert level is critical.
err_msg No The log used for recording execution errors. This parameter can be configured as a global variable. If the message output is configured with verify and the result of verify is false, an err_msg must be provided.

Judgment types supported by verify_type:

At present, the judgment types supported by verify_type apply only the base and int types.

  • between: checks whether the value of the parameter specified by the set_value parameter falls within the range specified by the verify parameter.
  • max: checks whether the value of the parameter specified by the set_value parameter is less than that specified by the verify parameter.
  • min: checks whether the value of the parameter specified by the set_value parameter is greater than that specified by the verify parameter.
  • equal: checks whether the value of the parameter specified by the set_value parameter is equal to that specified by the verify parameter.

base

You can replace new_expr with the expression specified by the verify parameter to manually verify the logic in your local environment.

if ${new_expr}; then
    echo "true"
else
    echo "false"
fi

Manually update tasks

We will update these tasks from time to time to provide more effective inspection tasks. To update your inspection package to the latest version, copy the ${code_path}/handler/check/tasks folder and the *check_package.yaml file from the code repository of obdiag to replace the original tasks folder and *check_package.yaml file in the ~/.obdiag/ directory.

Previous topic

Configure obdiag
Last

Next topic

Inspection metrics
Next
What is on this page
Prerequisites
check commands
Syntax
Tutorial for writing a task
Preparations
Write the task script
Manually update tasks