达梦数据库
达梦数据库采集器可以从达梦数据库实例中采集实例运行状态指标。
配置¶
采集器配置¶
进入 DataKit 安装目录下的 conf.d/samples 目录,复制 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] 指定其它标签:
dameng_memory¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| buffer_size_mb | Size of the buffer pool in MB. Type: float | (gauge) Unit: digital,MB | 
| mem_pool_size_mb | Size of the memory pool in MB. Type: float | (gauge) Unit: digital,MB | 
| total_size_mb | Total memory size (buffer pool + memory pool) in MB. Type: float | (gauge) Unit: digital,MB | 
dameng_mem_pool¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| is_overflow ( tag) | Whether the memory pool is in overflow state (Y/N) | 
| is_shared ( tag) | Whether the memory pool is shared (Y/N) | 
| pool_name ( tag) | Name of the memory pool | 
| data_size_mb | Data size in the memory pool in MB. Type: float | (gauge) Unit: digital,MB | 
| extend_size | Size of extended memory in the pool. Type: int | (gauge) Unit: count | 
| n_extend_exclusive | Number of exclusive memory extensions. Type: int | (gauge) Unit: count | 
| n_extend_normal | Number of normal memory extensions. Type: int | (gauge) Unit: count | 
| org_size_mb | Original size of the memory pool in MB. Type: float | (gauge) Unit: digital,MB | 
| reserved_size_mb | Reserved size of the memory pool in MB. Type: float | (gauge) Unit: digital,MB | 
| target_size | Target size of the memory pool. Type: int | (gauge) Unit: count | 
| total_size_mb | Total size of the memory pool in MB. Type: float | (gauge) Unit: digital,MB | 
dameng_tablespace¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| tablespace_name ( tag) | Name of the table space | 
| free_size_mb | Free size of the table space in MB. Type: float | (gauge) Unit: digital,MB | 
| max_block_mb | Maximum block size in MB. Type: float | (gauge) Unit: digital,MB | 
| total_size_mb | Total size of the table space in MB. Type: float | (gauge) Unit: digital,MB | 
| usage_ratio | Usage ratio of the table space as a percentage. Type: float | (gauge) Unit: percent,percent | 
| used_size_mb | Used size of the table space in MB. Type: float | (gauge) Unit: digital,MB | 
dameng_connections¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| active_connections | Number of active connections to the database. Type: int | (gauge) Unit: count | 
| idle_connections | Number of idle connections in the database. Type: int | (gauge) Unit: count | 
| max_connections | Maximum number of connections allowed. Type: int | (gauge) Unit: count | 
dameng_rates¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| qps | Queries per second executed in the database. Type: float | (gauge) Unit: count | 
| tps | Transactions per second (commits + rollbacks) in the database. Type: float | (gauge) Unit: count | 
dameng_slow_query¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| sess_id ( tag) | Session ID of the slow query | 
| sql_id ( tag) | Unique identifier of the slow query | 
| sql_text ( tag) | Truncated SQL query text. | 
| exec_time | Execution time of the slow query in milliseconds. Type: int | (gauge) Unit: time,ms | 
| n_runs | Number of times the slow query has been executed. Type: int | (gauge) Unit: count | 
dameng_locks¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| waiting_locks | Number of waiting locks in the database. Type: int | (gauge) Unit: count | 
dameng_deadlock¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| deadlock_sess_id ( tag) | Session ID of the deadlock | 
| deadlock_trx_id ( tag) | Transaction ID of the deadlock | 
| host ( tag) | The server address or the host name | 
| deadlock_count | Number of times the deadlock has occurred. Type: int | (gauge) Unit: count | 
dameng_buffer_cache¶
| Tags & Fields | Description | 
|---|---|
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| pool_name ( tag) | Name of the buffer pool | 
| buffer_hit_ratio | Buffer cache hit ratio as a percentage. Type: float | (gauge) Unit: percent,percent | 
| total_size_bytes | Total size of the buffer pool in bytes. Type: int | (gauge) Unit: digital,B | 
| total_size_gb | Total size of the buffer pool in GB. Type: float | (gauge) Unit: digital,GB | 
dameng_block_sessions¶
| Tags & Fields | Description | 
|---|---|
| blocked_lock_type ( tag) | Type of the lock causing the block (e.g., object_lock, transaction_lock) | 
| blocked_sess_id ( tag) | Session ID of the blocked session | 
| blocked_start_time ( tag) | Start time of the blocked session | 
| blocked_trx_id ( tag) | Transaction ID of the blocked session | 
| blocking_ip ( tag) | Client IP of the blocking session | 
| blocking_sess_id ( tag) | Session ID of the blocking session | 
| blocking_trx_id ( tag) | Transaction ID of the blocking session | 
| database ( tag) | The name of the database | 
| host ( tag) | The server address or the host name | 
| block_duration_min | Duration of the block in minutes. Type: float | (gauge) Unit: time,min | 
日志¶
- 
在达梦数据库运行过程中,会将一些关键信息记录到安装目录下一级 log 目录下的名称为 dm_<instance-name>_YYYYMM.log的日志文件中。比如:dm_DMSERVER_202507.log
- 
达梦数据库采集器默认是未开启日志采集功能,可在 conf.d/samples/dameng.conf 中 将 files打开,并写入达梦日志文件的绝对路径。比如:
开启日志采集后,默认会产生日志来源(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 | 日志产生时间 |