---
title: 台账信息收集功能说明
description: "使用命令通过终端工具进行系统迁移应用台账信息收集。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengdevps/portingadvisor/systemmigration/KunpengDevKitCli_0062.html
sourcePath: /source/zh/kunpengdevps/portingadvisor/systemmigration/KunpengDevKitCli_0062.html
indexId: 6f1a892fe70a1957b41146a2ecd77964e4ae92097d09160ebbf6f876eaaf388581
---
# 台账信息收集功能说明

#### 命令功能

使用命令通过终端工具进行系统迁移应用台账信息收集。


#### 命令格式

- Linux环境
  1 devkit sys-mig [-h | --help] [-c stmt | --command stmt] [-cf configure_file_path | --config configure_file_path] [-d scan_path | --directory scan_path] [-src source_file_path | --source source_file_path] [-t stmt_template_path | --template stmt_template_path] [-db db_config | --db-config db_config] [-mn group_name | --multi-node group_name] [-ec | --encipher] [-s source_path | --show source_path] [-o report_dir | --output report_dir] [-l {0,1,2,3} | --log-level {0,1,2,3}] [-v | --version]

- Windows环境
  1 sys-mig.exe [-h | --help] [-c stmt | --command stmt] [-cf configure_file_path | --config configure_file_path] [-d scan_path | --directory scan_path] [-src source_file_path | --source source_file_path] [-o report_dir | --output report_dir] [-t stmt_template_path | --template stmt_template_path] [-l {0,1,2,3} | --log-level {0,1,2,3}] [-s source_path | --show source_path] [-v | --version]


#### 参数说明


**表1 参数说明**

| 参数 | 参数选项 | 说明 |
| --- | --- | --- |
| \-h/\-\-help | \- | 可选参数，获取帮助信息。 |
| \-c/\-\-command | stmt | 必选参数，收集信息的模式。 功能为收集台账信息，可生成CSV报告。 |
| \-cf/\-\-config | \- | 可选参数，输入参数配置文件路径。支持通过配置文件方式输入参数，默认模板位置为“./sys\-mig/resources/sysmig\_default.conf”，详情请参见配置文件使用示例。 |
| \-d/\-\-directory | \- | 可选参数，输入扫描文件目录，用于收集台账信息。支持输入多个目录，多个目录间以空格分隔。 例如：/home/test1 /home/test2。 |
| \-src/\-\-source | \- | 可选参数，输入扫描文件目录，用于统计源码行数。支持输入多个目录，多个目录间以空格分隔。 支持的源代码语言：Java、C、C++、Python、Shell、JS、HTML和CSS。 如果待扫描的目录名称中包含空格，请使用单引号标识该参数。 |
| \-t/\-\-template | \- | 可选参数，输入台账扫描结果模板路径，默认按照程序内置模板生成扫描结果。 说明： 默认模板位置为“./sys\-mig/template/stmt\_template\_default.csv”。文件有两行数据，第一行是待搜索的信息，第二行是搜索信息对应的内部变量，可删除或更换位置，但不可修改。 |
| \-o/\-\-output | \- | 可选参数，报告输出目录，默认为sys\-mig二进制所在report目录。 例如：/home/report。 |
| \-l/\-\-log\-level | 0/1/2/3 | 可选参数，设置日志级别，默认为1。 0：日志级别为DEBUG。 1：日志级别为INFO。 2：日志级别为WARNING。 3：日志级别为ERROR。 |
| \-db/\-\-db\-config | \- | 可选参数，收集数据库信息，支持多节点数据库信息收集，仅支持Linux环境。支持以下两种方式： 命令行指定：格式为databaseUser@host:port:databaseType，多个以空格分隔。 配置文件指定：格式为databaseUser@host:port:databaseType encr\-passwd:\*\*\*\*\*，其中encr\-passwd为通过devkit sys\-mig \-ec加密密文。 |
| \-mn/\-\-multi\-node | all/ungrouped/groupName | 可选参数，远程扫描服务器的组名，仅支持Linux环境。配置文件为“./sys\-mig/nodes/nodes.conf”，具体格式请参见配置文件使用说明（\-mn/\-\-multi\-node）。 说明： 所有组都放在all组下，未分组的服务器配置放在ungrouped组下。 |
| \-ec/\-\-encipher | \- | 可选参数，输入需要加密的文本。 |
| \-s/\-\-show | \- | 可选参数，主要用于展示中间件和数据库的源路径。若不指定，则扫描报告中将不会展示中间件和数据库的源路径。 |
| \-v/\-\-version | \- | 可选参数，展示程序版本信息。 |


#### 使用示例

- 本地节点信息收集：
  此处以收集“/home/software”目录下信息，统计“/opt/code”下代码行数且扫描报告输出至“/home/report”为例，请根据实际情况替换需要扫描的文件路径。 1 devkit sys-mig -c stmt -d /home/software -src /opt/code -o /home/report

  返回信息如下：

  1 2 3 4 5 6 7 8 9 10 [2025-11-18 19:29:31,635] [INFO] Start to execute the command: ./devkit sys-mig -c stmt -cf /usr/local/devkit/sys-mig/resources/sysmig_default.conf -d /home/software -o /home/report -t /usr/local/devkit/sys-mig/template/stmt_template_default.csv -l 1 -src /opt/code [2025-11-18 19:29:31,635] [INFO] Creating file indexing... [2025-11-18 19:29:31,667] [INFO] Parsing... [2025-11-18 19:29:31,667] [INFO] Start scanning stmt information. [2025-11-18 19:29:31,668] [INFO] Middleware binary start analysis. [2025-11-18 19:29:31,668] [INFO] Middleware binary end of analysis. [2025-11-18 19:29:31,668] [INFO] Middleware package start analysis. [2025-11-18 19:29:31,668] [INFO] Middleware package end of analysis. Csv report is created successfully. The file is located in /home/report/sys-mig_xx.xx.xx.xx_20251118192931/stmt.csv [2025-11-18 19:29:31,681] [INFO] Scanning information successfully completed.

- 远程多节点信息收集：
用户需提前获取目标服务器的IP地址、SSH相关的用户名/密码/端口、扫描地址。当目标服务器与本地服务器架构不一致时，需要准备可适配目标服务器执行信息收集的软件包，架构可通过uname -m查看。

  1. 加密目标服务器登录密码。
    1 devkit sys-mig -ec

    按照提示输入需要加密的文本：

    1 2 3 4 please enter the password(the password must contain a maximum of 32 characters): Initializing the working key... Please wait. encrypted password: ***********************************************************************

  2. 配置目标服务器信息文件，默认模板位置为“./sys-mig/nodes/nodes.conf”，如下为示例，请用户根据实际情况进行配置。
    group1分组下为192.168.0.2/192.168.0.3两个节点，group2分组下为192.168.0.4，group2为group1的子节点，可以继承[group1:vars]中参数配置。

    1 2 3 4 5 6 7 8 9 10 [group1] 192.168.0.2 ssh_pass=**** scan_dir=/home 192.168.0.3 ssh_pass=**** scan_dir=/home/test,/home/test1 [group1:vars] ssh_user=root ssh_port=22 [group2] 192.168.0.4 ssh_pass=**** scan_dir=/home/test [group1:children] group2

  3. 执行以下命令收集台账信息。
    1 devkit sys-mig -c stmt -d /home/software -mn all

    返回信息如下：

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 [2025-11-27 19:01:41,425] [INFO] Start to execute the command: ./devkit sys-mig -c stmt -cf /usr/local/devkit/sys-mig/resources/sysmig_default.conf -d /home/software -o /usr/local/devkit/sys-mig/report -t /usr/local/devkit/sys-mig/template/stmt_template_default.csv -l 1 -mn all [2025-11-27 19:01:41,425] [INFO] Creating file indexing... [2025-11-27 19:01:41,570] [INFO] Parsing... [2025-11-27 19:01:41,598] [INFO] [multi_node] 192.168.0.2 Connecting to the server... [2025-11-27 19:01:41,599] [INFO] [multi_node] 192.168.0.3 Connecting to the server... [2025-11-27 19:01:41,599] [INFO] Start scanning stmt information. [2025-11-27 19:01:41,600] [INFO] [multi_node] 192.168.0.4 Connecting to the server... [2025-11-27 19:01:41,601] [INFO] Middleware binary start analysis. [2025-11-27 19:01:41,601] [INFO] Middleware binary end of analysis. [2025-11-27 19:01:41,603] [INFO] Middleware package start analysis. [2025-11-27 19:01:41,604] [INFO] Middleware package end of analysis. [2025-11-27 19:01:41,624] [INFO] Scanning information successfully completed. [2025-11-27 19:01:43,590] [INFO] [multi_node] 192.168.0.4 Successfully connected to the server. [2025-11-27 19:01:43,688] [INFO] [multi_node] 192.168.0.3 Successfully connected to the server. [2025-11-27 19:01:43,715] [INFO] [multi_node] 192.168.0.2 Successfully connected to the server. [2025-11-27 19:01:44,057] [INFO] [multi_node] 192.168.0.4 Uploading the collection software package... [2025-11-27 19:01:44,168] [INFO] [multi_node] 192.168.0.3 Uploading the collection software package... [2025-11-27 19:01:44,211] [INFO] [multi_node] 192.168.0.2 Uploading the collection software package... [2025-11-27 19:02:20,499] [INFO] [multi_node] 192.168.0.3 Successfully uploaded the collection software package. [2025-11-27 19:02:20,517] [INFO] [multi_node] 192.168.0.4 Successfully uploaded the collection software package. [2025-11-27 19:02:20,723] [INFO] [multi_node] 192.168.0.2 Successfully uploaded the collection software package. [2025-11-27 19:02:25,755] [INFO] [multi_node] 192.168.0.4 Collecting information about the remote server... Please wait 1 minute. [2025-11-27 19:02:25,918] [INFO] [multi_node] 192.168.0.3 Collecting information about the remote server... Please wait 1 minute. [2025-11-27 19:02:25,986] [INFO] [multi_node] 192.168.0.2 Collecting information about the remote server... Please wait 1 minute. [2025-11-27 19:03:28,336] [INFO] [multi_node] 192.168.0.4 Successfully collected information about the remote server. [2025-11-27 19:03:28,348] [INFO] [multi_node] 192.168.0.4 Downloading the collection result file... [2025-11-27 19:03:29,140] [INFO] [multi_node] 192.168.0.2 Successfully collected information about the remote server. [2025-11-27 19:03:29,146] [INFO] [multi_node] 192.168.0.2 Downloading the collection result file... [2025-11-27 19:03:29,216] [INFO] [multi_node] 192.168.0.3 Successfully collected information about the remote server. [2025-11-27 19:03:29,222] [INFO] [multi_node] 192.168.0.3 Downloading the collection result file... [2025-11-27 19:03:30,994] [INFO] [multi_node] 192.168.0.4 Successfully downloaded the collection result file. [2025-11-27 19:03:31,802] [INFO] [multi_node] 192.168.0.2 Successfully downloaded the collection result file. [2025-11-27 19:03:31,917] [INFO] [multi_node] 192.168.0.3 Successfully downloaded the collection result file. [multi_node] Successfully generated the collection result to /usr/local/devkit/sys-mig/report/sys-mig_xx.xx.xx.xx_20251127190141/stmt.csv. [multi_node] Successfully generated the collection result to /usr/local/devkit/sys-mig/report/sys-mig_xx.xx.xx.xx_20251127190141/stmt_en.csv.


#### 配置文件使用说明（-mn/--multi-node）

```
[groupName]
host key=value
[groupName:vars]
ssh_port=
ssh_user=
ssh_pass=
soft_path=
scan_dir=
[groupName:children]
groupName
[groupName:host]
host
```

- [groupName]：分组名称，由字母、数字组成。
- host key=value：节点IP和参数值，多个参数以空格分隔，支持以下参数：

  - ssh_port：端口号，默认22。
  - ssh_user：用户名。
  - ssh_pass：通过devkit sys-mig -ec命令加密的用户密码。
  - soft_path：当目标服务器与本地服务器架构不一致时，需要指定本地服务器上可适配目标服务器执行信息收集的软件包解压后目录。
  - scan_dir：目标服务器的扫描目录，多个请使用英文逗号分隔。
- [groupName:vars]：分组全局参数设置，格式为key=value，可被子分组继承。
- [groupName:children]：子分组，指定父子关系。
- [groupName:host]：指定分组中服务器的IP地址。


#### 输出报告说明


**表2 输出报告说明**

| 报告类型 | 报告详细说明 |
| --- | --- |
| CSV | 用于展示服务器台账信息，信息主要包含服务器规格、中间件、数据库等信息。 |
