From ddf3149c6fd52b66fd2bd94289af97682a2d1ae6 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 26 Mar 2024 11:09:43 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0boostkit=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/isv/boostkit.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tools/isv/boostkit.py diff --git a/tools/isv/boostkit.py b/tools/isv/boostkit.py new file mode 100644 index 0000000..e69de29 -- Gitee From b565a2481781ae7886081e6a38a74aa5d10e5e65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=88=E6=B5=A9=E6=9D=B0?= <2965713873@qq.com> Date: Wed, 27 Mar 2024 01:01:34 +0000 Subject: [PATCH 02/13] update tools/acceptance_command_line.py. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 师浩杰 <2965713873@qq.com> --- tools/acceptance_command_line.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/acceptance_command_line.py b/tools/acceptance_command_line.py index 47f0709..c3fa2ce 100644 --- a/tools/acceptance_command_line.py +++ b/tools/acceptance_command_line.py @@ -69,7 +69,7 @@ class AcceptanceTool(object): contents += "
  • {}
  • ".format(output_content) if not html_line: - print("""\033[31m未发现的devkit-pipeline相关工具报告\033[0m""") + print("""\033[31m未发现devkit-pipeline相关工具报告\033[0m""") html_contents = '

    Acceptance report

    '.format( contents) -- Gitee From f2b88212ead625fabee51e7e81feb86c13e4a46a Mon Sep 17 00:00:00 2001 From: jy Date: Wed, 27 Mar 2024 15:56:23 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=86=E6=9E=90?= =?UTF-8?q?=E4=BB=A5=E5=8F=8A=E8=A7=A3=E6=9E=90=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/collect_msg.sh | 79 +++++++++++++++++++++++++++++++++++++++++++ tools/config.ini | 5 +++ tools/isv/boostkit.py | 0 tools/isv_tool.py | 55 ++++++++++++++++++++++++++++++ 4 files changed, 139 insertions(+) create mode 100644 tools/collect_msg.sh create mode 100644 tools/config.ini delete mode 100644 tools/isv/boostkit.py create mode 100644 tools/isv_tool.py diff --git a/tools/collect_msg.sh b/tools/collect_msg.sh new file mode 100644 index 0000000..1fbfeb4 --- /dev/null +++ b/tools/collect_msg.sh @@ -0,0 +1,79 @@ +######################################################################### +# File Name: collect_msg.sh +# Author: **** +# mail: ****.com +# Created Time: Wed Mar 27 14:56:03 2024 +######################################################################### +#!/bin/bash +current_path=$(pwd) +config_file=$current_path/config.ini +log_path=$current_path/log +default_project="Bigdata Database Storage Arm Cala Kae Virtual" + + +#####################根据section以及key值获取对应value############ +acquire_value(){ + + project=$1 + key=$2 + grep $project -A 2 $config_file |awk -F -v section=$key '$1==section{print $2}' |awk '{print $1}' +} + + +######################获取配置文件中选择校验的解决方案########### +acquire_select_project(){ + all_name="" + for per_project in $default_project + do + status=$(acquire_value $per_project check) + if [[ $status = True ]]; then + all_name="$all_name $per_project" + fi + done + echo $all_name +} + +####################机密计算特性信息收集################ + +collect_virtcca_msg(){ + + + +} + + + +main(){ + if [ -e $config_file ]; then + select_project=$(acquire_select_project) + echo "开始收集BoostKit 特性信息如下:$select_project" + mkdir -p $log_path + echo "日志存放位置: $log_path" + else + echo "config.ini not exist" + exit 1 + fi + + for per_project in $select_project + do + if [ $per_project = "Bigdata" ]; + then + echo "start collect Bigdata msg..." + elif [ $per_project = "virtcca" ]; + then + echo "start collect virtcca msg..." + + fi + +} + + + + + + + + + + + diff --git a/tools/config.ini b/tools/config.ini new file mode 100644 index 0000000..d2d494f --- /dev/null +++ b/tools/config.ini @@ -0,0 +1,5 @@ +[virtcca] +check=True +cvm_name=cvm1 +cvm_username=root +cvm_password=huawei diff --git a/tools/isv/boostkit.py b/tools/isv/boostkit.py deleted file mode 100644 index e69de29..0000000 diff --git a/tools/isv_tool.py b/tools/isv_tool.py new file mode 100644 index 0000000..93e64dd --- /dev/null +++ b/tools/isv_tool.py @@ -0,0 +1,55 @@ +import logging + + +Logger = logging.getLogger() +Logger.setLevel(level=logging.INFO) +File_log = logging.FileHandler("./isv.log", "a") +File_log.setFormatter(logging.Formatter("%(message)s")) +Logger.addHandler(File_log) + + +class IsvTool: + def __init__(): + self.log = Logger + self.method_dict = { + "database_no_lock": self.no_lock, + "database_thread_pool": self.thread_pool, + } + + def no_lock(self, log_path): + self.log.info(f"no_lock: {log_path}") + return True + + def thread_pool(self, log_path): + self.log.info(f"thread_pool: {log_path}") + return True + + def check_virtcca_cvm(self, log_path): + create_cvm_status = False + start_cvm_status = False + with open(log_path) as f: + for per_line in f.readlines(): + if "launchSecurity type=\'cvm\''" + create_cvm_status = True + elif "etc" in per_line: + start_cvm_status = True + + self.log.info(f"create_cvm_status: {create_cvm_status} start_cvm_status: {start_cvm_status}") + if start_cvm_status and create_cvm_status + return True + else: + return False + + + def analysis(self, *log_path_list): + not_include_log = list() + result = dict() + for per_log in log_path_list: + per_log_strip = per_log.replace(".log", "") + method_exec = self.method_dict.get(per_log_strip, None) + if not method_exec: + not_include_log.append(per_log) + continue + result[per_log_strip] = meth_exec(per_log) + + return result -- Gitee From 9cb66b9577d2d8a70e7713c7ab2f942fb6174f5f Mon Sep 17 00:00:00 2001 From: jy Date: Wed, 27 Mar 2024 15:58:11 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E6=96=B0=E5=A2=9Evirtcca=E6=9C=BA?= =?UTF-8?q?=E5=AF=86=E8=99=9A=E6=9C=BA=E7=8A=B6=E6=80=81=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/collect_msg.sh | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/tools/collect_msg.sh b/tools/collect_msg.sh index 1fbfeb4..d551764 100644 --- a/tools/collect_msg.sh +++ b/tools/collect_msg.sh @@ -36,13 +36,29 @@ acquire_select_project(){ ####################机密计算特性信息收集################ collect_virtcca_msg(){ - - - + cvm_name=$2 + username=$3 + passwd=$4 + ret=$(grep -i "type='cvm'" /etc/libvirt/qemu/$cvm_name) + if [-e $ret];then + echo "$ret" > $log_path/virtcca_status.log + expect << EOF + spawn virsh console $cvm_name + expect "Escape character is \\^]" + send "\r" + expect "login:" + send "$username\r" + expect "Password:" + send "$passwd\r" + interact + EOF + dirret = cd / && ls + echo "$dirret" > $log_path/virtcca_status.log + else + echo "virtcca status is Error" > $log_path/virt_status.log } - main(){ if [ -e $config_file ]; then select_project=$(acquire_select_project) -- Gitee From a598fe3da59c18f03c8c57e246b38e77326ea8d8 Mon Sep 17 00:00:00 2001 From: jy Date: Wed, 27 Mar 2024 16:49:11 +0800 Subject: [PATCH 05/13] arm native --- tools/collect_msg.sh | 29 ++++++++++++++++++++++++++++- tools/config.ini | 8 ++++++++ tools/isv_tool.py | 28 +++++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 2 deletions(-) diff --git a/tools/collect_msg.sh b/tools/collect_msg.sh index d551764..88c4cdc 100644 --- a/tools/collect_msg.sh +++ b/tools/collect_msg.sh @@ -33,6 +33,30 @@ acquire_select_project(){ echo $all_name } +###################arm原生特性信息收集################# +# $1 docker容器名 + +collect_arm_native(){ + kbox_container=$1 + vdeio_container=$2 + instruction_container=$3 + # kbox基础云手机 + docker exec -i $kbox_container logcat |grep gralloc.kbox.so >> $log_path/arm_native_kbox.log + docekr exec -i $kbox_container cat /proc/sys/fs/binfmt_misc/ubt_a32a64 >> $log_path/arm_native_kbox.log + + + # 视频流 + docker exec -it $video_container logcat |grep -i "Init engine module" >> $log_path/arm_native_kbox.log + + # 指令流 + docekr exec -it $instruction_container ps -ef|grep VmiAgent >> $log_path/arm_native_kbox.log + + +} + + + + ####################机密计算特性信息收集################ collect_virtcca_msg(){ @@ -59,6 +83,9 @@ collect_virtcca_msg(){ } + + + main(){ if [ -e $config_file ]; then select_project=$(acquire_select_project) @@ -80,7 +107,7 @@ main(){ echo "start collect virtcca msg..." fi - + done } diff --git a/tools/config.ini b/tools/config.ini index d2d494f..69f7164 100644 --- a/tools/config.ini +++ b/tools/config.ini @@ -3,3 +3,11 @@ check=True cvm_name=cvm1 cvm_username=root cvm_password=huawei + + + +[arm] +check=True +kbox_container=kbox_1 # 基础kbox +video_container=kbox_2 # 视频流容器 +instuction_container=kbox_3 #指令流容器 diff --git a/tools/isv_tool.py b/tools/isv_tool.py index 93e64dd..b2875c0 100644 --- a/tools/isv_tool.py +++ b/tools/isv_tool.py @@ -1,3 +1,4 @@ +import re import logging @@ -15,6 +16,10 @@ class IsvTool: "database_no_lock": self.no_lock, "database_thread_pool": self.thread_pool, } + self.basic_key_word = [ + "", + + ] def no_lock(self, log_path): self.log.info(f"no_lock: {log_path}") @@ -39,7 +44,28 @@ class IsvTool: return True else: return False - + + def check_arm_native(self, log_path): + basic = True + video = True + instruction = True + with open(log_path) as f: + content = f.read() + for per_key_word in self.basic_key_word: + re_res = re.compile(f"{per_key_word}").findall(content) + if not re_res: + basic = False + break + + video_res = re.compile(f"Init engine module").findall(content) + if not video_res: + video = False + + instruction_res = re.compile(f"VmiAgent instruction").findall(content) + if not instruction_res: + instruction = False + + return { "basic": basic, "video": video, "instruction": instruction} def analysis(self, *log_path_list): not_include_log = list() -- Gitee From 586e2d1658c2454ba1e6979e090ea00c041de6e9 Mon Sep 17 00:00:00 2001 From: jy Date: Wed, 27 Mar 2024 17:16:25 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=99=9A=E6=8B=9F?= =?UTF-8?q?=E5=8C=96=E9=83=A8=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/collect_msg.sh | 9 +++++++++ tools/isv_tool.py | 31 +++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/tools/collect_msg.sh b/tools/collect_msg.sh index 88c4cdc..3fc18ea 100644 --- a/tools/collect_msg.sh +++ b/tools/collect_msg.sh @@ -36,6 +36,7 @@ acquire_select_project(){ ###################arm原生特性信息收集################# # $1 docker容器名 + collect_arm_native(){ kbox_container=$1 vdeio_container=$2 @@ -54,6 +55,14 @@ collect_arm_native(){ } +#################虚拟化特性信息收集################## + +collect_virtual(){ + ovs-appctl hwoff/dump-hw-flows |grep "No flow available" >> virtual_feautre.log + sudo systemctl status waasagent.service >> virtual_feature.log + waasctl --version >> virtual_feature.log +} + diff --git a/tools/isv_tool.py b/tools/isv_tool.py index b2875c0..b48f36e 100644 --- a/tools/isv_tool.py +++ b/tools/isv_tool.py @@ -15,7 +15,7 @@ class IsvTool: self.method_dict = { "database_no_lock": self.no_lock, "database_thread_pool": self.thread_pool, - } + } self.basic_key_word = [ "", @@ -44,7 +44,7 @@ class IsvTool: return True else: return False - + def check_arm_native(self, log_path): basic = True video = True @@ -66,6 +66,33 @@ class IsvTool: instruction = False return { "basic": basic, "video": video, "instruction": instruction} + + def check_virtual_ovs(self, log_path): + # ovs 卸载检测 + status = False + with open(log_path) as f: + if not re.compile("No flow available").findall(f.read()) + status = True + + return status + + def check_load_awareness(self, log_path): + # 负载动态感知检测 + running_status = False + version_status = False + with open(log_pat) as f: + if re.compile("active (running)").findall(f.read()) + running_status = True + if re.compile("waasctl: 1.0.0").findall(f.read()) and \ + re.compile("Wass Agent: 1.0.0").findall(f.read()): + version_status = True + + if running_status and version_status: + return True + else: + return False + + def analysis(self, *log_path_list): not_include_log = list() -- Gitee From 192b39549268c553b8b01af1ecb04c3631c8d99f Mon Sep 17 00:00:00 2001 From: jy Date: Thu, 28 Mar 2024 10:50:18 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/collect_msg.sh | 13 ++++++++++++- tools/config.ini | 5 +++++ tools/isv_tool.py | 29 ++++++++++++++++++++++++++--- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/tools/collect_msg.sh b/tools/collect_msg.sh index 3fc18ea..569ae64 100644 --- a/tools/collect_msg.sh +++ b/tools/collect_msg.sh @@ -63,7 +63,18 @@ collect_virtual(){ waasctl --version >> virtual_feature.log } - +################数据库特性信息收集################## +collect_database(){ + mysql_install_path=$1 + plugin_path=$1/lib/plugin + ls $plugin_path |grep thread_pool.so >> $log_path/database_mysql.log + ls $plygin_path |grep ha_kovae.so >> $log_path/database_mysql.log + cd $mysql_install_path + readelf -a bin/mysqld|grep bolt >> $log_path/database_mysq.log + no_lock: $(objdump -d mysqld|grep -c row_vers_build_for_semi_consistent_readP5trx_t) >> $log_path/database_mysql.log + objdump -d bin/mysqld |grep crc32cb >> $log_path/database_mysql.log + cd - +} ####################机密计算特性信息收集################ diff --git a/tools/config.ini b/tools/config.ini index 69f7164..2013624 100644 --- a/tools/config.ini +++ b/tools/config.ini @@ -11,3 +11,8 @@ check=True kbox_container=kbox_1 # 基础kbox video_container=kbox_2 # 视频流容器 instuction_container=kbox_3 #指令流容器 + + +[database] +check=True +mysql_install_path=/usr/local/mysql diff --git a/tools/isv_tool.py b/tools/isv_tool.py index b48f36e..9d6addc 100644 --- a/tools/isv_tool.py +++ b/tools/isv_tool.py @@ -61,7 +61,7 @@ class IsvTool: if not video_res: video = False - instruction_res = re.compile(f"VmiAgent instruction").findall(content) + instruction_res = re.compile(f"VmiAgent instruction").findall(content) if not instruction_res: instruction = False @@ -80,7 +80,7 @@ class IsvTool: # 负载动态感知检测 running_status = False version_status = False - with open(log_pat) as f: + with open(log_path) as f: if re.compile("active (running)").findall(f.read()) running_status = True if re.compile("waasctl: 1.0.0").findall(f.read()) and \ @@ -91,8 +91,31 @@ class IsvTool: return True else: return False + + + def check_database(self, log_path): + thread_pool, kovae, gcc_compile, no_lock, crc32 = False, False, False, False, False + with open(log_path) as f: + content = f.read() + if re.compile("thread_pool.so").findall(content): + thread_pool = True + + if re.compile("ha_kovae.so").findall(content): + kovae = True + + if re.compile("blot").findall(content): + gcc_compile = True + + no_lock_list = re.compile("no_lock: (\d+)").findall(content): + if int(no_lock_list[0]) > 0: + no_lock = True + + if re.compile("crcewcb").findall(content): + crc32 = True + + return {"thread_pool": thread_pool, "kovae": kovae, "gcc_compile": gcc_compile, "nolock": no_lock, "crc32": crc32} + - def analysis(self, *log_path_list): not_include_log = list() -- Gitee From 014f782a35d94e79921fdceff25315f768f668c3 Mon Sep 17 00:00:00 2001 From: jy Date: Thu, 28 Mar 2024 10:56:47 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E6=96=B0?= =?UTF-8?q?=E5=A2=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/collect_msg.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/collect_msg.sh b/tools/collect_msg.sh index 569ae64..a6d7598 100644 --- a/tools/collect_msg.sh +++ b/tools/collect_msg.sh @@ -125,9 +125,13 @@ main(){ elif [ $per_project = "virtcca" ]; then echo "start collect virtcca msg..." + elif [ $per_project = "database" ]; + then + echo "start collect database msg..." + collect_database $(acquire_value database mysql_install_path) fi - done + done } -- Gitee From b59ee6acd4bc7f76be56c59193c5fd9613777a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=88=E6=B5=A9=E6=9D=B0?= <2965713873@qq.com> Date: Thu, 28 Mar 2024 04:40:04 +0000 Subject: [PATCH 09/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20to?= =?UTF-8?q?ols/acceptance=5Fcommand=5Fline.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/acceptance_command_line.py | 109 ------------------------------- 1 file changed, 109 deletions(-) delete mode 100644 tools/acceptance_command_line.py diff --git a/tools/acceptance_command_line.py b/tools/acceptance_command_line.py deleted file mode 100644 index c3fa2ce..0000000 --- a/tools/acceptance_command_line.py +++ /dev/null @@ -1,109 +0,0 @@ -import os -import zipfile -import tarfile -import argparse - - -class AcceptanceTool(object): - def devkit_acceptance_report(self, compressed_report_package): - if not os.path.exists(compressed_report_package): - print("请输入正确的报告压缩包") - return - file_ext = os.path.splitext(compressed_report_package)[1].lower() - if file_ext not in (".zip", ".gz", ".bz2"): - print("请使用以下格式的压缩包:zip、gz、bz2") - return - report_name = compressed_report_package.split("/")[-1].split("_") - devkit_pipeline_name = "" - devkit_pipeline_id = "" - if len(report_name) == 3: - devkit_pipeline_name = report_name[0] - devkit_pipeline_id = report_name[1] - decompress = {".zip": decompress_zip, ".gz": decompress_gz_bz, ".bz2": decompress_gz_bz} - current_path = os.getcwd() - print("开始解压") - file_names = decompress.get(file_ext)(compressed_report_package) - command_line_html = {"64-bit-running-mode-check.html": "64位运行模式检查", - "memory-consistency-check.html": "内存一致性检查", - "SoftwareMigrationAssessment.html": "软件迁移评估", - "byte-alignment-check.html": "字节对齐检查", "SourceCodeScanningReport.html": "源码迁移", - "compatibility_report.html": "云测工具"} - print("解压完成。") - print("流水线{}构建{}devkit-pipeline相关工具报告扫描中...".format(devkit_pipeline_name, devkit_pipeline_id)) - html_line = "" - contents = "" - for file in file_names: - if file.split("/")[-1] in command_line_html.keys(): - try: - with open(os.path.join(current_path, file), encoding="utf-8") as f: - content = f.readlines() - except UnicodeDecodeError: - with open(os.path.join(current_path, file), encoding="gbk") as f: - content = f.readlines() - if file.split("/")[-1] != "compatibility_report.html": - flag = 0 - for html_line in content: - if "Source File Path" in html_line and file != "SoftwareMigrationAssessment.html": - flag += 1 - continue - elif "Software Package Path or Name" in html_line: - flag += 1 - continue - if flag == 1: - html_line = \ - html_line.replace("""""", "").replace("""""", "").strip().split("/")[ - -1] - break - else: - for html_line in content: - if "Compatibility_Application_Start" in html_line: - str1 = html_line.find("7528") - str2 = html_line.find("542f") - html_line = html_line[str1 + 3 + 1: str2 - 2] - break - output_content = """{}: - 报告路径:{} - 被扫描软件名称:{}""".format(command_line_html.get(file.split("/")[-1]), - os.path.join(current_path, file), html_line) - print(output_content) - contents += "
  • {}
  • ".format(output_content) - - if not html_line: - print("""\033[31m未发现devkit-pipeline相关工具报告\033[0m""") - - html_contents = '

    Acceptance report

      {}
    '.format( - contents) - with open('./{}_{}_htmlreports.html'.format(devkit_pipeline_name, devkit_pipeline_id), 'w') as f: - f.write(html_contents) - - -def decompress_zip(compressed_report_package): - with zipfile.ZipFile(compressed_report_package) as zip: - zip.extractall("./") - file_names = zip.namelist() - return file_names - - -def decompress_gz_bz(compressed_report_package): - with tarfile.open(compressed_report_package, "r") as tar: - tar.extractall(path="./") - file_names = tar.getnames() - return file_names - - -if __name__ == "__main__": - try: - parser = argparse.ArgumentParser() - parser.add_argument('-tool', help='DevKit or BoostKit') - parser.add_argument('-package', help='Compressed package') - args = parser.parse_args() - acceptance_tool = AcceptanceTool() - if args.tool == "DevKit": - acceptance_tool.devkit_acceptance_report(args.package) - elif args.tool == "BoostKit": - pass - else: - print("请输入正确的参数,如-tool Devkit 或 -tool BoostKit") - except Exception as err: - print(err) - print("请输入正确的参数") \ No newline at end of file -- Gitee From 44a8736e25cfffd407a9e1f9d011adeee81978d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=88=E6=B5=A9=E6=9D=B0?= <2965713873@qq.com> Date: Thu, 28 Mar 2024 04:40:29 +0000 Subject: [PATCH 10/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20to?= =?UTF-8?q?ols/collect=5Fmsg.sh?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/collect_msg.sh | 146 ------------------------------------------- 1 file changed, 146 deletions(-) delete mode 100644 tools/collect_msg.sh diff --git a/tools/collect_msg.sh b/tools/collect_msg.sh deleted file mode 100644 index a6d7598..0000000 --- a/tools/collect_msg.sh +++ /dev/null @@ -1,146 +0,0 @@ -######################################################################### -# File Name: collect_msg.sh -# Author: **** -# mail: ****.com -# Created Time: Wed Mar 27 14:56:03 2024 -######################################################################### -#!/bin/bash -current_path=$(pwd) -config_file=$current_path/config.ini -log_path=$current_path/log -default_project="Bigdata Database Storage Arm Cala Kae Virtual" - - -#####################根据section以及key值获取对应value############ -acquire_value(){ - - project=$1 - key=$2 - grep $project -A 2 $config_file |awk -F -v section=$key '$1==section{print $2}' |awk '{print $1}' -} - - -######################获取配置文件中选择校验的解决方案########### -acquire_select_project(){ - all_name="" - for per_project in $default_project - do - status=$(acquire_value $per_project check) - if [[ $status = True ]]; then - all_name="$all_name $per_project" - fi - done - echo $all_name -} - -###################arm原生特性信息收集################# -# $1 docker容器名 - - -collect_arm_native(){ - kbox_container=$1 - vdeio_container=$2 - instruction_container=$3 - # kbox基础云手机 - docker exec -i $kbox_container logcat |grep gralloc.kbox.so >> $log_path/arm_native_kbox.log - docekr exec -i $kbox_container cat /proc/sys/fs/binfmt_misc/ubt_a32a64 >> $log_path/arm_native_kbox.log - - - # 视频流 - docker exec -it $video_container logcat |grep -i "Init engine module" >> $log_path/arm_native_kbox.log - - # 指令流 - docekr exec -it $instruction_container ps -ef|grep VmiAgent >> $log_path/arm_native_kbox.log - - -} - -#################虚拟化特性信息收集################## - -collect_virtual(){ - ovs-appctl hwoff/dump-hw-flows |grep "No flow available" >> virtual_feautre.log - sudo systemctl status waasagent.service >> virtual_feature.log - waasctl --version >> virtual_feature.log -} - -################数据库特性信息收集################## -collect_database(){ - mysql_install_path=$1 - plugin_path=$1/lib/plugin - ls $plugin_path |grep thread_pool.so >> $log_path/database_mysql.log - ls $plygin_path |grep ha_kovae.so >> $log_path/database_mysql.log - cd $mysql_install_path - readelf -a bin/mysqld|grep bolt >> $log_path/database_mysq.log - no_lock: $(objdump -d mysqld|grep -c row_vers_build_for_semi_consistent_readP5trx_t) >> $log_path/database_mysql.log - objdump -d bin/mysqld |grep crc32cb >> $log_path/database_mysql.log - cd - -} - - -####################机密计算特性信息收集################ - -collect_virtcca_msg(){ - cvm_name=$2 - username=$3 - passwd=$4 - ret=$(grep -i "type='cvm'" /etc/libvirt/qemu/$cvm_name) - if [-e $ret];then - echo "$ret" > $log_path/virtcca_status.log - expect << EOF - spawn virsh console $cvm_name - expect "Escape character is \\^]" - send "\r" - expect "login:" - send "$username\r" - expect "Password:" - send "$passwd\r" - interact - EOF - dirret = cd / && ls - echo "$dirret" > $log_path/virtcca_status.log - else - echo "virtcca status is Error" > $log_path/virt_status.log -} - - - - - -main(){ - if [ -e $config_file ]; then - select_project=$(acquire_select_project) - echo "开始收集BoostKit 特性信息如下:$select_project" - mkdir -p $log_path - echo "日志存放位置: $log_path" - else - echo "config.ini not exist" - exit 1 - fi - - for per_project in $select_project - do - if [ $per_project = "Bigdata" ]; - then - echo "start collect Bigdata msg..." - elif [ $per_project = "virtcca" ]; - then - echo "start collect virtcca msg..." - elif [ $per_project = "database" ]; - then - echo "start collect database msg..." - collect_database $(acquire_value database mysql_install_path) - - fi - done -} - - - - - - - - - - - -- Gitee From d5f01f49ac594a358b777bb7aee0a73abc5d7248 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=88=E6=B5=A9=E6=9D=B0?= <2965713873@qq.com> Date: Thu, 28 Mar 2024 04:40:39 +0000 Subject: [PATCH 11/13] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20to?= =?UTF-8?q?ols/config.ini?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/config.ini | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 tools/config.ini diff --git a/tools/config.ini b/tools/config.ini deleted file mode 100644 index 2013624..0000000 --- a/tools/config.ini +++ /dev/null @@ -1,18 +0,0 @@ -[virtcca] -check=True -cvm_name=cvm1 -cvm_username=root -cvm_password=huawei - - - -[arm] -check=True -kbox_container=kbox_1 # 基础kbox -video_container=kbox_2 # 视频流容器 -instuction_container=kbox_3 #指令流容器 - - -[database] -check=True -mysql_install_path=/usr/local/mysql -- Gitee From a249f9e76e71a99e2795dd4b3da3bb1ec360a038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=88=E6=B5=A9=E6=9D=B0?= <2965713873@qq.com> Date: Thu, 28 Mar 2024 04:42:46 +0000 Subject: [PATCH 12/13] add tools/collect_msg.sh. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 师浩杰 <2965713873@qq.com> --- tools/collect_msg.sh | 146 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 tools/collect_msg.sh diff --git a/tools/collect_msg.sh b/tools/collect_msg.sh new file mode 100644 index 0000000..8beaa24 --- /dev/null +++ b/tools/collect_msg.sh @@ -0,0 +1,146 @@ +######################################################################### +# File Name: collect_msg.sh +# Author: **** +# mail: ****.com +# Created Time: Wed Mar 27 14:56:03 2024 +######################################################################### +#!/bin/bash +current_path=$(pwd) +config_file=$current_path/config.ini +log_path=$current_path/log +default_project="Bigdata Database Storage Arm Cala Kae Virtual" + + +#####################根据section以及key值获取对应value############ +acquire_value(){ + + project=$1 + key=$2 + grep $project -A 2 $config_file |awk -F -v section=$key '$1==section{print $2}' |awk '{print $1}' +} + + +######################获取配置文件中选择校验的解决方案########### +acquire_select_project(){ + all_name="" + for per_project in $default_project + do + status=$(acquire_value $per_project check) + if [[ $status = True ]]; then + all_name="$all_name $per_project" + fi + done + echo $all_name +} + +###################arm原生特性信息收集################# +# $1 docker容器名 + + +collect_arm_native(){ + kbox_container=$1 + vdeio_container=$2 + instruction_container=$3 + # kbox基础云手机 + docker exec -i $kbox_container logcat |grep gralloc.kbox.so >> $log_path/arm_native_kbox.log + docekr exec -i $kbox_container cat /proc/sys/fs/binfmt_misc/ubt_a32a64 >> $log_path/arm_native_kbox.log + + + # 视频流 + docker exec -it $video_container logcat |grep -i "Init engine module" >> $log_path/arm_native_kbox.log + + # 指令流 + docekr exec -it $instruction_container ps -ef|grep VmiAgent >> $log_path/arm_native_kbox.log + + +} + +#################虚拟化特性信息收集################## + +collect_virtual(){ + ovs-appctl hwoff/dump-hw-flows |grep "No flow available" >> virtual_feautre.log + sudo systemctl status waasagent.service >> virtual_feature.log + waasctl --version >> virtual_feature.log +} + +################数据库特性信息收集################## +collect_database(){ + mysql_install_path=$1 + plugin_path=$1/lib/plugin + ls $plugin_path |grep thread_pool.so >> $log_path/database_mysql.log + ls $plygin_path |grep ha_kovae.so >> $log_path/database_mysql.log + cd $mysql_install_path + readelf -a bin/mysqld|grep bolt >> $log_path/database_mysq.log + no_lock: $(objdump -d mysqld|grep -c row_vers_build_for_semi_consistent_readP5trx_t) >> $log_path/database_mysql.log + objdump -d bin/mysqld |grep crc32cb >> $log_path/database_mysql.log + cd - +} + + +####################机密计算特性信息收集################ + +collect_virtcca_msg(){ + cvm_name=$2 + username=$3 + passwd=$4 + ret=$(grep -i "type='cvm'" /etc/libvirt/qemu/$cvm_name) + if [-e $ret];then + echo "$ret" > $log_path/virtcca_status.log + expect << EOF + spawn virsh console $cvm_name + expect "Escape character is \\^]" + send "\r" + expect "login:" + send "$username\r" + expect "Password:" + send "$passwd\r" + interact + EOF + dirret = cd / && ls + echo "$dirret" > $log_path/virtcca_status.log + else + echo "virtcca status is Error" > $log_path/virt_status.log +} + + + + + +main(){ + if [ -e $config_file ]; then + select_project=$(acquire_select_project) + echo "开始收集BoostKit 特性信息如下:$select_project" + mkdir -p $log_path + echo "日志存放位置: $log_path" + else + echo "config.ini not exist" + exit 1 + fi + + for per_project in $select_project + do + if [ $per_project = "Bigdata" ]; + then + echo "start collect Bigdata msg..." + elif [ $per_project = "virtcca" ]; + then + echo "start collect virtcca msg..." + elif [ $per_project = "database" ]; + then + echo "start collect database msg..." + collect_database $(acquire_value database mysql_install_path) + + fi + done +} + + + + + + + + + + + -- Gitee From 2104999b621941332f17abee75aa2c6f567d8467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=88=E6=B5=A9=E6=9D=B0?= <2965713873@qq.com> Date: Thu, 28 Mar 2024 04:43:23 +0000 Subject: [PATCH 13/13] add tools/config.ini. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 师浩杰 <2965713873@qq.com> --- tools/config.ini | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tools/config.ini diff --git a/tools/config.ini b/tools/config.ini new file mode 100644 index 0000000..b74e3fc --- /dev/null +++ b/tools/config.ini @@ -0,0 +1,18 @@ +[virtcca] +check=True +cvm_name=cvm1 +cvm_username=root +cvm_password=huawei + + + +[arm] +check=True +kbox_container=kbox_1 # 基础kbox +video_container=kbox_2 # 视频流容器 +instuction_container=kbox_3 #指令流容器 + + +[database] +check=True +mysql_install_path=/usr/local/mysql -- Gitee