!139 fix newline break error
From: @boluo56 Reviewed-by: @hubin95 Signed-off-by: @hubin95
This commit is contained in:
commit
aef2a35feb
48
fix-alarm_info-newline-break-error.patch
Normal file
48
fix-alarm_info-newline-break-error.patch
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
From fe1bb401c1f77860616e74c1dbf5fe6aa862b17d Mon Sep 17 00:00:00 2001
|
||||||
|
From: jinsaihang <jinsaihang@h-partners.com>
|
||||||
|
Date: Sat, 26 Oct 2024 07:18:16 +0000
|
||||||
|
Subject: [PATCH] fix alarm_info newline break error
|
||||||
|
|
||||||
|
Signed-off-by: jinsaihang <jinsaihang@h-partners.com>
|
||||||
|
---
|
||||||
|
sysSentry-1.0.2/src/python/syssentry/alarm.py | 23 +++++++++++++++++++
|
||||||
|
1 file changed, 23 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/src/python/syssentry/alarm.py b/src/python/syssentry/alarm.py
|
||||||
|
index 2575307..b35a126 100644
|
||||||
|
--- a/src/python/syssentry/alarm.py
|
||||||
|
+++ b/src/python/syssentry/alarm.py
|
||||||
|
@@ -180,7 +180,30 @@ def get_alarm_result(task_name: str, time_range: int, detailed: bool) -> List[Di
|
||||||
|
if 'details' in alarm_info:
|
||||||
|
alarm_info.pop('details', None)
|
||||||
|
alarm.pop('msg1', None)
|
||||||
|
+
|
||||||
|
+ # dump each {key,value} of details in one line
|
||||||
|
+ if 'details' in alarm_info and isinstance(alarm_info['details'], dict):
|
||||||
|
+ for key in alarm_info['details']:
|
||||||
|
+ alarm_info['details'][key] = json.dumps(alarm_info['details'][key], indent=None)
|
||||||
|
+
|
||||||
|
alarm['alarm_info'] = alarm_info
|
||||||
|
+ alarm_list = [alarm for alarm in alarm_list if 'alarm_source' in alarm['alarm_info'] and alarm['alarm_info']['alarm_source'] == task_name]
|
||||||
|
+
|
||||||
|
+ alarm_level_mapping = {
|
||||||
|
+ 1: 'MINOR_ALM',
|
||||||
|
+ 2: 'MAJOR_ALM',
|
||||||
|
+ 3: 'CRITICAL_ALM'
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ alarm_type_mapping = {
|
||||||
|
+ 1: 'ALARM_TYPE_OCCUR',
|
||||||
|
+ 2: 'ALARM_TYPE_RECOVER'
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ for alarm in alarm_list:
|
||||||
|
+ alarm['alarm_level'] = alarm_level_mapping.get(alarm['alarm_level'], 'UNKNOWN_LEVEL')
|
||||||
|
+ alarm['alarm_type'] = alarm_type_mapping.get(alarm['alarm_type'], 'UNKNOWN_TYPE')
|
||||||
|
return alarm_list
|
||||||
|
+
|
||||||
|
finally:
|
||||||
|
alarm_list_lock.release()
|
||||||
|
--
|
||||||
|
2.27.0
|
||||||
|
|
||||||
@ -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: 50
|
Release: 51
|
||||||
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
|
||||||
@ -70,6 +70,7 @@ Patch57: update-collect-plugin-period-max.patch
|
|||||||
Patch58: fix-frequency-param-check-bug.patch
|
Patch58: fix-frequency-param-check-bug.patch
|
||||||
Patch59: ai_block_io-support-iodump.patch
|
Patch59: ai_block_io-support-iodump.patch
|
||||||
Patch60: fix-get_alarm-error.patch
|
Patch60: fix-get_alarm-error.patch
|
||||||
|
Patch61: fix-alarm_info-newline-break-error.patch
|
||||||
|
|
||||||
BuildRequires: cmake gcc-c++
|
BuildRequires: cmake gcc-c++
|
||||||
BuildRequires: python3 python3-setuptools
|
BuildRequires: python3 python3-setuptools
|
||||||
@ -331,6 +332,12 @@ rm -rf %{buildroot}
|
|||||||
%attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin*
|
%attr(0550,root,root) %{python3_sitelib}/sentryCollector/__pycache__/collect_plugin*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Sat Oct 26 2024 jinsaihang <jinsaihang@h-partners.com> - 1.0.2-51
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DES:fix newline break error
|
||||||
|
|
||||||
* Sat Oct 26 2024 zhangnan <zhangnan134@huawei.com> - 1.0.2-50
|
* Sat Oct 26 2024 zhangnan <zhangnan134@huawei.com> - 1.0.2-50
|
||||||
- Type:bugfix
|
- Type:bugfix
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user