From c1da6e295d09d6db67fa4fb4e6de88fc77c47bbe Mon Sep 17 00:00:00 2001 From: zhuofeng Date: Sat, 12 Oct 2024 16:07:41 +0800 Subject: [PATCH] add pysentry_collect package and update collect log modify abnormal stack when the disk field is not configured --- ...stack-when-the-disk-field-is-not-con.patch | 28 ++++++++++++++++++ sysSentry.spec | 29 ++++++++++++++++++- update-collect-log.patch | 25 ++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 modify-abnormal-stack-when-the-disk-field-is-not-con.patch create mode 100644 update-collect-log.patch diff --git a/modify-abnormal-stack-when-the-disk-field-is-not-con.patch b/modify-abnormal-stack-when-the-disk-field-is-not-con.patch new file mode 100644 index 0000000..5b0084b --- /dev/null +++ b/modify-abnormal-stack-when-the-disk-field-is-not-con.patch @@ -0,0 +1,28 @@ +From b5794ef43f768d7ea9bbbac450deaabbdcff4997 Mon Sep 17 00:00:00 2001 +From: zhuofeng +Date: Sat, 12 Oct 2024 17:57:01 +0800 +Subject: [PATCH] modify abnormal stack when the disk field is not configured + +--- + src/python/sentryCollector/collect_config.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/python/sentryCollector/collect_config.py b/src/python/sentryCollector/collect_config.py +index 5aa38ec..7ca9898 100644 +--- a/src/python/sentryCollector/collect_config.py ++++ b/src/python/sentryCollector/collect_config.py +@@ -127,9 +127,9 @@ class CollectConfig: + CONF_IO, CONF_IO_MAX_SAVE, CONF_IO_MAX_SAVE_DEFAULT) + result_io_config[CONF_IO_MAX_SAVE] = CONF_IO_MAX_SAVE_DEFAULT + # disk +- disk = io_map_value.get(CONF_IO_DISK).lower() ++ disk = io_map_value.get(CONF_IO_DISK) + if disk: +- disk_str = disk.replace(" ", "") ++ disk_str = disk.lower().replace(" ", "") + pattern = r'^[a-zA-Z0-9-_,]+$' + if not re.match(pattern, disk_str): + logging.warning("module_name = %s section, field = %s is incorrect, use default %s", +-- +2.33.0 + diff --git a/sysSentry.spec b/sysSentry.spec index 1639a71..7a52fc6 100644 --- a/sysSentry.spec +++ b/sysSentry.spec @@ -4,7 +4,7 @@ Summary: System Inspection Framework Name: sysSentry Version: 1.0.2 -Release: 36 +Release: 37 License: Mulan PSL v2 Group: System Environment/Daemons Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -53,6 +53,8 @@ Patch40: add-xalarm-cleanup-invalid-server-socket-peroidly.patch Patch41: ai_block_io-support-stage-and-iotype.patch Patch42: fix-io_dump-for-collect-module.patch Patch43: add-root-cause-analysis.patch +Patch44: update-collect-log.patch +Patch45: modify-abnormal-stack-when-the-disk-field-is-not-con.patch BuildRequires: cmake gcc-c++ BuildRequires: python3 python3-setuptools @@ -94,6 +96,7 @@ This package provides CPU fault detection Summary: Supports slow I/O detection Requires: sysSentry = %{version}-%{release} Requires: pysentry_notify = %{version}-%{release} +Requires: pysentry_collect = %{version}-%{release} %description -n avg_block_io This package provides Supports slow I/O detection based on EBPF @@ -102,6 +105,8 @@ This package provides Supports slow I/O detection based on EBPF Summary: Supports slow I/O detection Requires: python3-numpy Requires: sysSentry = %{version}-%{release} +Requires: pysentry_notify = %{version}-%{release} +Requires: pysentry_collect = %{version}-%{release} %description -n ai_block_io This package provides Supports slow I/O detection based on AI @@ -120,6 +125,13 @@ Requires: sysSentry = %{version}-%{release} %description -n pysentry_notify This package provides Supports xalarm report for plugins +%package -n pysentry_collect +Summary: Supports collect in python immplementation +Requires: sysSentry = %{version}-%{release} + +%description -n pysentry_collect +This package provides Supports collect for plugins + %prep %autosetup -n %{name}-%{version} -p1 @@ -260,6 +272,10 @@ rm -rf %{buildroot} %attr(0600,root,root) %{_sysconfdir}/sysSentry/collector.conf %attr(0600,root,root) %{_unitdir}/sentryCollector.service +# pysentry_collect +%exclude %{python3_sitelib}/sentryCollector/collect_plugin.py +%exclude %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin* + %files -n libxalarm %attr(0550,root,root) %{_libdir}/libxalarm.so @@ -296,7 +312,18 @@ rm -rf %{buildroot} %attr(0600,root,root) %{_sysconfdir}/sysSentry/plugins/ai_block_io.ini %attr(0550,root,root) %{python3_sitelib}/sentryPlugins/ai_block_io +%files -n pysentry_collect +%attr(0550,root,root) %{python3_sitelib}/sentryCollector/collect_plugin.py +%attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin* + %changelog +* Sat Oct 12 2024 zhuofeng - 1.0.2-37 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:add pysentry_collect package and update collect log + modify abnormal stack when the disk field is not configured + * Sat Oct 12 2024 heyouzhi - 1.0.2-36 - Type:requirement - CVE:NA diff --git a/update-collect-log.patch b/update-collect-log.patch new file mode 100644 index 0000000..2624eb4 --- /dev/null +++ b/update-collect-log.patch @@ -0,0 +1,25 @@ +From 73f5028fcab08613833c9f2b432f660c70ac264e Mon Sep 17 00:00:00 2001 +From: zhuofeng +Date: Sat, 12 Oct 2024 16:06:32 +0800 +Subject: [PATCH] update collect log + +--- + src/python/sentryCollector/collect_io.py | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/python/sentryCollector/collect_io.py b/src/python/sentryCollector/collect_io.py +index 2b10cde..f699c3c 100644 +--- a/src/python/sentryCollector/collect_io.py ++++ b/src/python/sentryCollector/collect_io.py +@@ -156,7 +156,7 @@ class CollectIo(): + for line in file: + count += line.count('.op=' + Io_Category[category].upper()) + if count > 0: +- logging.info(f"io_dump info : {disk_name}, {stage}, {category}, {count}") ++ logging.info(f"io_dump info : {disk_name}, {stage}, {Io_Category[category]}, {count}") + except FileNotFoundError: + logging.error("The file %s does not exist.", io_dump_file) + return count +-- +2.33.0 + -- Gitee