Skip to content

OceanBase

·


Collecting OceanBase performance metrics through the sys tenant.

Already tested version:

  • OceanBase Enterprise 3.2.4

Configuration

Precondition

  • Create a monitoring account

Create a monitoring account using a sys tenant account and grant the following privileges:

CREATE USER 'datakit'@'localhost' IDENTIFIED BY '<UNIQUEPASSWORD>';

-- MySQL 8.0+ create the datakit user with the caching_sha2_password method
CREATE USER 'datakit'@'localhost' IDENTIFIED WITH caching_sha2_password by '<UNIQUEPASSWORD>';

-- Grant the required permissions 
GRANT SELECT ON *.* TO 'datakit'@'localhost';
Info
  • Note that if you find the collector has the following error when using localhost , you need to replace the above localhost with ::1:

    Error 1045: Access denied for user 'datakit'@'localhost' (using password: YES)`
    
  • All the above creation and authorization operations limit that the user datakit can only access OceanBase on local host (localhost). If OceanBase is collected remotely, it is recommended to replace localhost with % (indicating that DataKit can access OceanBase on any machine), or use a specific DataKit installation machine address.

Collector Configuration

Go to the conf.d/samples directory under the DataKit installation directory, copy oceanbase.conf.sample and name it oceanbase.conf. Examples are as follows:

[[inputs.oceanbase]]
  # host name
  host = "localhost"

  ## port
  port = 2883

  ## tenant name
  tenant = "sys"

  ## cluster name
  cluster = "obcluster"

  ## user name
  user = "datakit"

  ## password
  password = "<PASS>"

  ## database name
  database = "oceanbase"

  ## mode. mysql only.
  mode = "mysql"

  ## @param connect_timeout - number - optional - default: 10s
  # connect_timeout = "10s"

  interval = "10s"

  ## OceanBase slow query time threshold defined. If larger than this, the executed sql will be reported.
  slow_query_time = "0s"

  ## Set true to enable election
  election = true

  ## Run a custom SQL query and collect corresponding metrics.
  # [[inputs.oceanbase.custom_queries]]
    # sql = '''
    #   select
    #     CON_ID tenant_id,
    #     STAT_ID,
    #     replace(name, " ", "_") metric_name,
    #     VALUE
    #   from
    #     v$sysstat;
    # '''
    # metric = "oceanbase_custom"
    # tags = ["metric_name", "tenant_id"]
    # fields = ["VALUE"]

  [inputs.oceanbase.tags]
    # some_tag = "some_value"
    # more_tag = "some_other_value"

Once configured, restart DataKit.

The collector can now be turned on by ConfigMap Injection Collector Configuration.

Long Running Queries

DataKit could reports the SQLs, those executed time exceeded the threshold time defined by user, to Guance, displays in the Logs side bar, the source name is oceanbase_log.

This function is disabled by default, user could enabling it by modify DataKit's OceanBase configuration like followings:

Change the string value after slow_query_time from 0s to the threshold time, minimal value is 1 millsecond. Generally, recommand it to 10s.

slow_query_time = "0s"
Info
  • failed_obfuscate:SQL obfuscated failed reason. Only exist when SQL obfuscated failed. Original SQL will be reported when SQL obfuscated failed. For more fields, see here.
  • If the string value after --slow-query-time is 0s or empty or less than 1 millisecond, this function is disabled, which is also the default state.
  • The SQL would not display here when execute not complete.

Metric

For all of the following data collections, the global election tags will added automatically, we can add extra tags in [inputs.oceanbase.tags] if needed:

 [inputs.oceanbase.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"
  # ...

oceanbase_stat

OceanBase system statistics from gv$sysstat, reported by cluster, tenant, server IP, stat ID, and metric name.

Tags & Fields Description
cluster
(tag)
Cluster Name
host
(tag)
The server address or the host Name
metric_name
(tag)
The name of the statistical event.
stat_id
(tag)
The ID of the statistical event.
svr_ip
(tag)
The IP address of the server where the information is located.
tenant_id
(tag)
Tenant id
tenant_name
(tag)
Tenant Name
metric_value The value of the statistical item.
Type: float | (gauge)
Unit: N/A
Tagged by: cluster, metric_name, stat_id, svr_ip, tenant_id, tenant_name

oceanbase_cache_block

OceanBase block cache size from __all_virtual_kvcache_info, grouped by cluster, tenant, server, and cache name.

Tags & Fields Description
cache_name
(tag)
The cache name.
cluster
(tag)
Cluster Name
host
(tag)
The server address or the host Name
svr_ip
(tag)
The IP address of the server where the information is located.
svr_port
(tag)
The port of the server where the information is located.
tenant_id
(tag)
Tenant id
tenant_name
(tag)
Tenant Name
cache_size The block cache size in bytes for the specified cache.
Type: int | (gauge)
Unit: digital,B
Tagged by: cache_name, cluster, svr_ip, svr_port, tenant_id, tenant_name

oceanbase_cache_plan

OceanBase plan cache access and hit counters from gv$plan_cache_stat, grouped by cluster, tenant, server IP, and server port.

Tags & Fields Description
cluster
(tag)
Cluster Name
host
(tag)
The server address or the host Name
svr_ip
(tag)
The IP address of the server where the information is located.
svr_port
(tag)
The port of the server where the information is located.
tenant_id
(tag)
Tenant id
tenant_name
(tag)
Tenant Name
access_count The number of times that the query accesses the plan cache.
Type: int | (count)
Unit: count
Tagged by: cluster, svr_ip, svr_port, tenant_id, tenant_name
hit_count The number of plan cache hits.
Type: int | (count)
Unit: count
Tagged by: cluster, svr_ip, svr_port, tenant_id, tenant_name

oceanbase_event

OceanBase non-idle system wait event totals from gv$system_event, grouped by cluster, tenant, server IP, and event group.

Tags & Fields Description
cluster
(tag)
Cluster Name
event_group
(tag)
The group of the event.
host
(tag)
The server address or the host Name
svr_ip
(tag)
The IP address of the server where the information is located.
tenant_id
(tag)
Tenant id
tenant_name
(tag)
Tenant Name
time_waited The total wait time for the event in seconds.
Type: float | (count)
Unit: time,s
Tagged by: cluster, event_group, svr_ip, tenant_id, tenant_name
total_waits The total number of waits for the event.
Type: float | (count)
Unit: count
Tagged by: cluster, event_group, svr_ip, tenant_id, tenant_name

oceanbase_session

OceanBase current session counts from __all_virtual_processlist, grouped by cluster, tenant, server IP, and server port.

Tags & Fields Description
cluster
(tag)
Cluster Name
host
(tag)
The server address or the host Name
svr_ip
(tag)
The IP address of the server where the information is located.
svr_port
(tag)
The port of the server where the information is located.
tenant_id
(tag)
Tenant id
tenant_name
(tag)
Tenant Name
active_cnt The number of active sessions within a tenant.
Type: int | (gauge)
Unit: count
Tagged by: cluster, svr_ip, svr_port, tenant_id, tenant_name
all_cnt The total number of sessions within a tenant.
Type: int | (gauge)
Unit: count
Tagged by: cluster, svr_ip, svr_port, tenant_id, tenant_name

oceanbase_clog

OceanBase clog synchronization delay from virtual clog statistics, grouped by cluster, tenant, server, and replica type.

Tags & Fields Description
cluster
(tag)
Cluster Name
host
(tag)
The server address or the host Name
replica_type
(tag)
The type of the replica
svr_ip
(tag)
The IP address of the server where the information is located.
svr_port
(tag)
The port of the server where the information is located.
tenant_id
(tag)
Tenant id
tenant_name
(tag)
Tenant Name
max_clog_sync_delay_seconds The max clog synchronization delay of an tenant.
Type: float | (gauge)
Unit: time,s
Tagged by: cluster, replica_type, svr_ip, svr_port, tenant_id, tenant_name

Log

oceanbase_log

OceanBase slow-query log records collected from GV$SQL_AUDIT for the configured database service.

Tags & Fields Description
cluster
(tag)
Cluster Name
host
(tag)
Hostname.
oceanbase_server
(tag)
The address of the database instance (including port).
oceanbase_service
(tag)
OceanBase service name.
message The text of the logging.
Type: string
Unit: N/A
status The status of the logging, only supported info/emerg/alert/critical/error/warning/debug/OK/unknown.
Type: string
Unit: N/A

Feedback

Is this page helpful? ×