diff --git a/fix-absolute-threshold-not-be-used.patch b/fix-absolute-threshold-not-be-used.patch new file mode 100644 index 0000000000000000000000000000000000000000..13e3def726a38c4c966158d726db65b0573ef471 --- /dev/null +++ b/fix-absolute-threshold-not-be-used.patch @@ -0,0 +1,56 @@ +From 11483f4efe29ac971379f845078701f44b430682 Mon Sep 17 00:00:00 2001 +From: Youzhi He +Date: Fri, 15 Nov 2024 17:34:35 +0800 +Subject: [PATCH] fix when ai threshold update but absolute threshold not be + used + +--- + .../ai_block_io/sliding_window.py | 20 +++++++++---------- + 1 file changed, 10 insertions(+), 10 deletions(-) + +diff --git a/src/python/sentryPlugins/ai_block_io/sliding_window.py b/src/python/sentryPlugins/ai_block_io/sliding_window.py +index ff3fa3b..a13033f 100644 +--- a/src/python/sentryPlugins/ai_block_io/sliding_window.py ++++ b/src/python/sentryPlugins/ai_block_io/sliding_window.py +@@ -30,20 +30,20 @@ class SlidingWindow: + self._io_data_queue = [] + self._io_data_queue_abnormal_tag = [] + ++ def is_abnormal(self, data): ++ if self._avg_lim is not None and data < self._avg_lim: ++ return False ++ if self._ai_threshold is not None and data > self._ai_threshold: ++ return True ++ if self._abs_threshold is not None and data > self._abs_threshold: ++ return True ++ + def push(self, data: float): + if len(self._io_data_queue) == self._queue_length: + self._io_data_queue.pop(0) + self._io_data_queue_abnormal_tag.pop(0) + self._io_data_queue.append(data) +- tag = False +- if self._avg_lim is not None and data < self._avg_lim: +- tag = False +- self._io_data_queue_abnormal_tag.append(tag) +- return tag +- if self._ai_threshold is not None and data > self._ai_threshold: +- tag = True +- if self._abs_threshold is not None and data > self._abs_threshold: +- tag = True ++ tag = self.is_abnormal(data) + self._io_data_queue_abnormal_tag.append(tag) + return tag + +@@ -53,7 +53,7 @@ class SlidingWindow: + self._ai_threshold = threshold + self._io_data_queue_abnormal_tag.clear() + for data in self._io_data_queue: +- self._io_data_queue_abnormal_tag.append(data >= self._ai_threshold) ++ self._io_data_queue_abnormal_tag.append(self.is_abnormal(data)) + + def is_slow_io_event(self, data): + return False, None, None, None +-- +2.27.0 + diff --git a/sysSentry.spec b/sysSentry.spec index f2ffd1c7c7b2b57536a4774efb5648019fd3828e..fe12957e505d34df34bf245924c376b9615b9406 100644 --- a/sysSentry.spec +++ b/sysSentry.spec @@ -4,7 +4,7 @@ Summary: System Inspection Framework Name: sysSentry Version: 1.0.2 -Release: 66 +Release: 67 License: Mulan PSL v2 Group: System Environment/Daemons Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -82,6 +82,7 @@ Patch69: modify-logrotate-rule.patch Patch70: fix-excessive-CPU-usage.patch Patch71: change-avg_block_io-config.patch Patch72: update-nvme-config.patch +Patch73: fix-absolute-threshold-not-be-used.patch BuildRequires: cmake gcc-c++ BuildRequires: python3 python3-setuptools @@ -353,6 +354,12 @@ rm -rf %{buildroot} %attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin* %changelog +* Fri Nov 15 2024 heyouzhi - 1.0.2-67 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:fix absolute threshold not be used + * Tue Nov 5 2024 zhangnan - 1.0.2-66 - Type:bugfix - CVE:NA