add pysentry_collect package and update collect log

modify abnormal stack when the disk field is not configured
This commit is contained in:
zhuofeng 2024-10-12 16:07:41 +08:00
parent b64bba7b6f
commit c1da6e295d
3 changed files with 81 additions and 1 deletions

View File

@ -0,0 +1,28 @@
From b5794ef43f768d7ea9bbbac450deaabbdcff4997 Mon Sep 17 00:00:00 2001
From: zhuofeng <zhuofeng2@huawei.com>
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

View File

@ -4,7 +4,7 @@
Summary: System Inspection Framework Summary: System Inspection Framework
Name: sysSentry Name: sysSentry
Version: 1.0.2 Version: 1.0.2
Release: 36 Release: 37
License: Mulan PSL v2 License: Mulan PSL v2
Group: System Environment/Daemons Group: System Environment/Daemons
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz 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 Patch41: ai_block_io-support-stage-and-iotype.patch
Patch42: fix-io_dump-for-collect-module.patch Patch42: fix-io_dump-for-collect-module.patch
Patch43: add-root-cause-analysis.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: cmake gcc-c++
BuildRequires: python3 python3-setuptools BuildRequires: python3 python3-setuptools
@ -94,6 +96,7 @@ This package provides CPU fault detection
Summary: Supports slow I/O detection Summary: Supports slow I/O detection
Requires: sysSentry = %{version}-%{release} Requires: sysSentry = %{version}-%{release}
Requires: pysentry_notify = %{version}-%{release} Requires: pysentry_notify = %{version}-%{release}
Requires: pysentry_collect = %{version}-%{release}
%description -n avg_block_io %description -n avg_block_io
This package provides Supports slow I/O detection based on EBPF 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 Summary: Supports slow I/O detection
Requires: python3-numpy Requires: python3-numpy
Requires: sysSentry = %{version}-%{release} Requires: sysSentry = %{version}-%{release}
Requires: pysentry_notify = %{version}-%{release}
Requires: pysentry_collect = %{version}-%{release}
%description -n ai_block_io %description -n ai_block_io
This package provides Supports slow I/O detection based on AI This package provides Supports slow I/O detection based on AI
@ -120,6 +125,13 @@ Requires: sysSentry = %{version}-%{release}
%description -n pysentry_notify %description -n pysentry_notify
This package provides Supports xalarm report for plugins 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 %prep
%autosetup -n %{name}-%{version} -p1 %autosetup -n %{name}-%{version} -p1
@ -260,6 +272,10 @@ rm -rf %{buildroot}
%attr(0600,root,root) %{_sysconfdir}/sysSentry/collector.conf %attr(0600,root,root) %{_sysconfdir}/sysSentry/collector.conf
%attr(0600,root,root) %{_unitdir}/sentryCollector.service %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 %files -n libxalarm
%attr(0550,root,root) %{_libdir}/libxalarm.so %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(0600,root,root) %{_sysconfdir}/sysSentry/plugins/ai_block_io.ini
%attr(0550,root,root) %{python3_sitelib}/sentryPlugins/ai_block_io %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 %changelog
* Sat Oct 12 2024 zhuofeng <zhuofeng2@huawei.com> - 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 <heyouzhi@huawei.com> - 1.0.2-36 * Sat Oct 12 2024 heyouzhi <heyouzhi@huawei.com> - 1.0.2-36
- Type:requirement - Type:requirement
- CVE:NA - CVE:NA

25
update-collect-log.patch Normal file
View File

@ -0,0 +1,25 @@
From 73f5028fcab08613833c9f2b432f660c70ac264e Mon Sep 17 00:00:00 2001
From: zhuofeng <zhuofeng2@huawei.com>
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