Collecting Application Information In System Migration Using Command Lines
Command Function
Collects application information in system migration using the terminal tool.
Syntax
- Linux:
devkit porting sys-mig -c,--command {stmt/sbom} -cf,--config configure_file_path -d,--directory scan_path -t,--template stmt_template_path -o,--output report_dir -f,--format {html/json} -e,--exclude-fields {version/checkOutPath} -l,--log-level {0/1/2/3} -v,--version -h,--help - Windows:
.\sys-mig.exe -c,--command {stmt/sbom} -cf,--config configure_file_path -d,--directory scan_path -t,--template stmt_template_path -o,--output report_dir -f,--format {html/json} -e,--exclude-fields {version/checkOutPath} -l,--log-level {0/1/2/3} -v,--version -h,--help
Parameter Description
Parameter |
Option |
Description |
|---|---|---|
-c/--command |
stmt/sbom |
Sets the information collection mode.
|
-cf/--config |
configure_file_path |
Configures a file path. |
-d/--directory |
scan_path |
Scans file paths. Multiple paths are supported, and you can separate them with spaces. |
-t/--template |
stmt_template_path |
This parameter is used for the stmt mode. It sets the template path of the ledger scan result. By default, the scan result is generated based on the built-in template of the program. |
-o/--output |
report_dir |
Sets the report output directory. The default directory is the report directory where the binary file is located. |
-f/--format |
html/json |
This parameter is used for the sbom mode. It sets the report format, of which the HTML and JSON formats are supported. The default format is HTML. Multiple formats can be selected, and you can separate them with spaces. |
-e/--exclude-fields |
version/checkOutPath |
This parameter is used for the sbom mode. It sets the parameter information to be hidden. The options are version and checkOutPath, which can be selected at the same time. version indicates the component version, and checkOutPath indicates the component checkout path. You can separate multiple parameters with spaces. |
-v/--version |
None |
Displays the program version information. There is no option to enter. |
-h/--help |
None |
Obtains help information. There is no option to enter. |
-l/--log-level |
0,1,2,3 |
Sets the log level. The options are 0 (DEBUG), 1 (INFO), 2 (WARNING) and 3 (ERROR). The default value is 1 (INFO). |
Example
The following describes how to analyze sysmig_default.conf in the porting/resources directory and generate an analysis report in CSV format. Replace porting/resources/sysmig_default.conf with the actual path of the configuration file.
devkit porting sys-mig -c stmt -cf porting/resources/sysmig_default.conf
The following information is returned. The output report is /home/stmt_xx.xx.xx.xx_20240307142402.csv.
[2024-03-07 14:24:02,424] [INFO] Start to execute the command: ./devkit porting sys-mig -c stmt -cf porting/resources/sysmig_default.conf -d /usr/local -o /home -t /home/stmt_template_default.csv -l 0 [2024-03-07 14:24:02,425] [INFO] Creating file indexing... [2024-03-07 14:24:04,580] [INFO] Parsing... [2024-03-07 14:24:04,580] [INFO] Start Scanning stmt information. [2024-03-07 14:24:04,581] [INFO] Middleware binary start analysis. [2024-03-07 14:24:06,513] [INFO] Middleware binary end of analysis. [2024-03-07 14:24:06,513] [INFO] Middleware binary start analysis. [2024-03-07 14:24:06,576] [INFO] Middleware package end of analysis. [2024-03-07 14:24:06,591] [INFO] csv report is created successfully. the file is located in /home/stmt_xx.xx.xx.xx_20240307142402.csv
Description of Configuration Files
The configuration file template of the system migration command line takes effect only when -cf or --config is executed. The default format is as follows:
# DESCRIPTION
# Configuration file template of the System Migration command line. It takes effect only when -cf or --config is executed.
# To use this template, delete the template comments below the help information and set the parameters. Note that parameters in the command line take precedence
# over those in the configuration file. If parameters have been set in the command line, the parameters in the configuration file do not take effect.
# OPTIONS
# command {stmt,sbom}
# Type of information to be collected. The options are (default) stmt and sbom. Stmt generates a CSV report, and sbom generates a detailed HTML or JSON report.
# directory <path> [<path> ...]
# Directory of scanning for collected information. You can enter multiple directories (the current directory by default).
# Separate multiple directories with spaces. If the name of the folder to be scanned contains spaces, use single quotation marks(') to mark the parameter.
# output <path>
# Report output directory. (The default is the report directory where the binary file is located.)
# template <file>
# This parameter is used in stmt mode. Enter the template path of the CSV report. (By default, the CSV report is generated based on the built-in template.)
# For details about the template, see ./resources/stmt_template_default.csv.
# Built-in variables used in the template include ${cpuCores}, ${memory}, ${middleware}, ${dbType}, ${osSystem}, ${ip}, and ${hostName}, and they cannot be modified.
# format {html,json} [{html,json} ...]
# Format of the report generated in sbom mode. The options are HTML and json. You can select multiple report formats. The default value is HTML.
# Separate multiple reports with spaces(Example: -f html json).
# exclude-fields {version,checkOutPath} [{version,checkOutPath} ...]
# Parameters hidden in sbom mode. The optional parameters are version and checkOutPath, and they can be selected at the same time.
# Version indicates the component version number and checkOutPath indicates the component checkout path. Separate multiple parameters with spaces.
# log-level {0,1,2,3}
# Log level. The options are 0(DEBUG), 1(INFO), 2(WARNING), and 3(ERROR). The default value is 1(INFO).
# [stmt]
# directory=
# output=
# template=
# log-level=
# [sbom]
# directory=
# output=
# format=
# exclude-fields=
# log-level=
- To use this template, delete the template comments below the help information and set the parameters.
For example, delete the comment tags in [stmt] or [sbom] and add your own configurations.
- Parameters in the command line take precedence over those in the configuration file. If parameters have been set in the command line, the parameters in the configuration file do not take effect.
Template Example in the stmt Mode
devkit porting sys-mig -c stmt -t template/stmt_tempalte_default.csv
The default template location of the -t/--template parameter is porting/template/stmt_tempalte_default.csv.
The template is a CSV file that contains two rows of information. The first row is the information to be searched for, and the second row is the internal variable of the searched information. For the internal variables, you can delete or move them, but cannot modify them.
Output Report Description
Report Type |
Description |
|---|---|
CSV |
Provides ledger information on the live network, including server specifications, middleware, and databases on the live network. |
JSON |
Provides metadata information about system components such as Java applications, middleware, OSs, and hardware, such as component names, versions, checkout paths, compatibility, and parent-child relationships between components. |
HTML |
Displays the relationships between system components such as Java applications, middleware, databases, and OSs in a tree diagram, and the basic information about each component, such as the component name, version, checkout path, and compatibility. |