From 134c4d9d186bfede34b9ceb98dba675b0550fdd9 Mon Sep 17 00:00:00 2001 From: jinsaihang Date: Wed, 23 Oct 2024 10:57:16 +0800 Subject: [PATCH] fix get_alarm error Signed-off-by: jinsaihang --- fix-get_alarm-error.patch | 36 ++++++++++++++++++++++++++++++++++++ sysSentry.spec | 9 ++++++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 fix-get_alarm-error.patch diff --git a/fix-get_alarm-error.patch b/fix-get_alarm-error.patch new file mode 100644 index 0000000..19d8dcc --- /dev/null +++ b/fix-get_alarm-error.patch @@ -0,0 +1,36 @@ +From 8f28a40ffd7dc7aa969a7bfc0a170ed0c8f03bce Mon Sep 17 00:00:00 2001 +From: jinsaihang +Date: Tue, 22 Oct 2024 20:28:59 +0800 +Subject: [PATCH] fix get_alarm error + +Signed-off-by: jinsaihang +--- + sysSentry-1.0.2/src/python/syssentry/alarm.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/python/syssentry/alarm.py b/src/python/syssentry/alarm.py +index c3f2ee1..2575307 100644 +--- a/src/python/syssentry/alarm.py ++++ b/src/python/syssentry/alarm.py +@@ -139,8 +139,6 @@ def get_alarm_result(task_name: str, time_range: int, detailed: bool) -> List[Di + return [] + alarm_id = task_alarm_id_dict[task_name] + clear_time = alarm_id_clear_time_dict[alarm_id] +- if clear_time < int(time_range): +- return [] + if alarm_id not in alarm_list_dict: + logging.debug("alarm_id does not exist") + return [] +@@ -154,6 +152,9 @@ def get_alarm_result(task_name: str, time_range: int, detailed: bool) -> List[Di + if timestamp - (xalarm_gettime(alarm_list[i])) / MILLISECONDS_UNIT_SECONDS > time_range: + stop_index = i + break ++ if timestamp - (xalarm_gettime(alarm_list[i])) / MILLISECONDS_UNIT_SECONDS > clear_time: ++ stop_index = i ++ break + if stop_index >= 0: + alarm_list = alarm_list[:stop_index] + logging.debug(f"get_alarm_result: final alarm_list of {alarm_id} has {len(alarm_list)} elements") +-- +2.27.0 + diff --git a/sysSentry.spec b/sysSentry.spec index 6988bb1..610ae72 100644 --- a/sysSentry.spec +++ b/sysSentry.spec @@ -4,7 +4,7 @@ Summary: System Inspection Framework Name: sysSentry Version: 1.0.2 -Release: 48 +Release: 49 License: Mulan PSL v2 Group: System Environment/Daemons Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -69,6 +69,7 @@ Patch56: fix-xalarm-non-uniform-log-formatting.patch Patch57: update-collect-plugin-period-max.patch Patch58: fix-frequency-param-check-bug.patch Patch59: ai_block_io-support-iodump.patch +Patch60: fix-get_alarm-error.patch BuildRequires: cmake gcc-c++ BuildRequires: python3 python3-setuptools @@ -331,6 +332,12 @@ rm -rf %{buildroot} %attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin* %changelog +* Wed Oct 23 2024 jinsaihang - 1.0.2-49 +- Type:bugfix +- CVE:NA +- SUG:NA +- DES:fix get_alarm error + * Tue Oct 22 2024 heyouzhi - 1.0.2-48 - Type:bugfix - CVE:NA -- Gitee