跳转至

达梦数据库

·


达梦数据库采集器可以从达梦数据库实例中采集实例运行状态指标。

配置

采集器配置

进入 DataKit 安装目录下的 conf.d/db 目录,复制 dameng.conf.sample 并命名为 dameng.conf。示例如下:

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

  ## port
  port = 5236

  ## user name
  user = "SYSDBA"

  ## password
  password = "datakit"

  ## database name
  database = "DMTEST"

  ## Slow query threshold in milliseconds, default 1000
  slow_query_threshold = 1000

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

  interval = "10s"

  ## Set true to enable election
  election = true

  ## Metric name in metric_exclude_list will not be collected.
  #
  metric_exclude_list = [""]

  ## Run a custom SQL query and collect corresponding metrics.
  #
  # [[inputs.dameng.custom_queries]]
  #   sql = 'SELECT name AS "name", stat_val AS "stat_val" FROM sys.v$sysstat;'
  #   metric = "dameng_custom_query"
  #   tags = ["name"]
  #   fields = ["stat_val"]
  #   interval = "30s"

  ## Log collection
  #
  [inputs.dameng.log]
    # files = []
    # pipeline = "dameng.p"
    ## The pattern should be a regexp. Note the use of '''this regexp'''
    ## regexp link: https://golang.org/pkg/regexp/syntax/#hdr-Syntax
    multiline_match = '''^\\d{4}-\\d{2}-\\d{2}\\s+\\d{2}:\\d{2}:\\d{2}\\s+\\[.*?\\]'''

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

配置好后,重启 DataKit 即可。

目前可以通过 ConfigMap 方式注入采集器配置来开启采集器。

指标

以下所有数据采集,默认会追加全局选举 tag,也可以在配置中通过 [inputs.dameng.tags] 指定其它标签:

DM_memory

  • 标签
Tag Description
database The name of the database
host The server address or the host name
  • 指标列表
Metric Description
buffer_size_mb Size of the buffer pool in MB.
Type: float
Unit: digital,MB
mem_pool_size_mb Size of the memory pool in MB.
Type: float
Unit: digital,MB
total_size_mb Total memory size (buffer pool + memory pool) in MB.
Type: float
Unit: digital,MB

dameng_mem_pool

  • 标签
Tag Description
database The name of the database
host The server address or the host name
is_overflow Whether the memory pool is in overflow state (Y/N)
is_shared Whether the memory pool is shared (Y/N)
pool_name Name of the memory pool
  • 指标列表
Metric Description
data_size_mb Data size in the memory pool in MB.
Type: float
Unit: digital,MB
extend_size Size of extended memory in the pool.
Type: int
Unit: count
n_extend_exclusive Number of exclusive memory extensions.
Type: int
Unit: count
n_extend_normal Number of normal memory extensions.
Type: int
Unit: count
org_size_mb Original size of the memory pool in MB.
Type: float
Unit: digital,MB
reserved_size_mb Reserved size of the memory pool in MB.
Type: float
Unit: digital,MB
target_size Target size of the memory pool.
Type: int
Unit: count
total_size_mb Total size of the memory pool in MB.
Type: float
Unit: digital,MB

dameng_tablespace

  • 标签
Tag Description
database The name of the database
host The server address or the host name
tablespace_name Name of the table space
  • 指标列表
Metric Description
free_size_mb Free size of the table space in MB.
Type: float
Unit: digital,MB
max_block_mb Maximum block size in MB.
Type: float
Unit: digital,MB
total_size_mb Total size of the table space in MB.
Type: float
Unit: digital,MB
usage_ratio Usage ratio of the table space as a percentage.
Type: float
Unit: percent,percent
used_size_mb Used size of the table space in MB.
Type: float
Unit: digital,MB

dameng_connections

  • 标签
Tag Description
database The name of the database
host The server address or the host name
  • 指标列表
Metric Description
active_connections Number of active connections to the database.
Type: int
Unit: count
idle_connections Number of idle connections in the database.
Type: int
Unit: count
max_connections Maximum number of connections allowed.
Type: int
Unit: count

dameng_rates

  • 标签
Tag Description
database The name of the database
host The server address or the host name
  • 指标列表
Metric Description
qps Queries per second executed in the database.
Type: float
Unit: count
tps Transactions per second (commits + rollbacks) in the database.
Type: float
Unit: count

dameng_slow_queries

  • 标签
Tag Description
database The name of the database
host The server address or the host name
sess_id Session ID of the slow query
sql_id Unique identifier of the slow query
sql_text Truncated SQL query text.
  • 指标列表
Metric Description
exec_time Execution time of the slow query in milliseconds.
Type: int
Unit: time,ms
n_runs Number of times the slow query has been executed.
Type: int
Unit: count

dameng_locks

  • 标签
Tag Description
database The name of the database
host The server address or the host name
  • 指标列表
Metric Description
waiting_locks Number of waiting locks in the database.
Type: int
Unit: count

dameng_deadlocks

  • 标签
Tag Description
database The name of the database
deadlock_sess_id Session ID of the deadlock
deadlock_trx_id Transaction ID of the deadlock
host The server address or the host name
  • 指标列表
Metric Description
deadlock_count Number of times the deadlock has occurred.
Type: int
Unit: count

dameng_buffer_cache

  • 标签
Tag Description
database The name of the database
host The server address or the host name
pool_name Name of the buffer pool
  • 指标列表
Metric Description
buffer_hit_ratio Buffer cache hit ratio as a percentage.
Type: float
Unit: percent,percent
total_size_bytes Total size of the buffer pool in bytes.
Type: int
Unit: digital,B
total_size_gb Total size of the buffer pool in GB.
Type: float
Unit: digital,GB

DM_block_sessions

  • 标签
Tag Description
blocked_lock_type Type of the lock causing the block (e.g., object_lock, transaction_lock)
blocked_sess_id Session ID of the blocked session
blocked_start_time Start time of the blocked session
blocked_trx_id Transaction ID of the blocked session
blocking_ip Client IP of the blocking session
blocking_sess_id Session ID of the blocking session
blocking_trx_id Transaction ID of the blocking session
database The name of the database
host The server address or the host name
  • 指标列表
Metric Description
block_duration_min Duration of the block in minutes.
Type: float
Unit: time,min

日志

  • 在达梦数据库运行过程中,会将一些关键信息记录到安装目录下一级 log 目录下的名称为 dm_<instance-name>_YYYYMM.log 的日志文件中。比如:dm_DMSERVER_202507.log

  • 达梦数据库采集器默认是未开启日志采集功能,可在 conf.d/db/dameng.conf 中 将 files 打开,并写入达梦日志文件的绝对路径。比如:

[[inputs.dameng]]

  ...

  [inputs.dameng.log]
    files = ["/home/dmdba/dmdbms/log/dm_DMSERVER_202507.log"]

开启日志采集后,默认会产生日志来源(source)为 dameng 的日志。

注意:日志采集仅支持已安装 DataKit 主机上的日志。

日志 Pipeline 切割

原始日志为

2025-07-03 10:16:20.659 [INFO] database P0000001485 T0000000000000001485  INI parameter ROLLSEG_POOLS changed, the original value 19, new value 1

切割后的字段说明:

字段名 字段值 说明
msg database P0000001485 T0000000000000001485 …… new value 1 日志内容
status INFO 当前日志的级别(ERROR,FATAL,WARNING,INFO)
time 1751537780 日志产生时间

文档评价

文档内容是否对您有帮助? ×