!129 fix get_alarm error

From: @boluo56 
Reviewed-by: @hubin95 
Signed-off-by: @hubin95
This commit is contained in:
openeuler-ci-bot 2024-10-23 03:41:56 +00:00 committed by Gitee
commit c312d921c4
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 44 additions and 1 deletions

36
fix-get_alarm-error.patch Normal file
View File

@ -0,0 +1,36 @@
From 8f28a40ffd7dc7aa969a7bfc0a170ed0c8f03bce Mon Sep 17 00:00:00 2001
From: jinsaihang <jinsaihang@h-partners.com>
Date: Tue, 22 Oct 2024 20:28:59 +0800
Subject: [PATCH] fix get_alarm error
Signed-off-by: jinsaihang <jinsaihang@h-partners.com>
---
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

View File

@ -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 <jinsaihang@h-partners.com> - 1.0.2-49
- Type:bugfix
- CVE:NA
- SUG:NA
- DES:fix get_alarm error
* Tue Oct 22 2024 heyouzhi <heyouzhi@huawei.com> - 1.0.2-48
- Type:bugfix
- CVE:NA