!119 update collect plugin period max

From: @zhuofeng6 
Reviewed-by: @hubin95 
Signed-off-by: @hubin95
This commit is contained in:
openeuler-ci-bot 2024-10-21 12:09:05 +00:00 committed by Gitee
commit 90e04e5082
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 52 additions and 1 deletions

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: 45 Release: 46
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
@ -66,6 +66,7 @@ Patch53: optimize-log-printing.patch
Patch54: enrich-alert-info-about-kernel-stack.patch Patch54: enrich-alert-info-about-kernel-stack.patch
Patch55: ai_block_io-lack-section-exit.patch Patch55: ai_block_io-lack-section-exit.patch
Patch56: fix-xalarm-non-uniform-log-formatting.patch Patch56: fix-xalarm-non-uniform-log-formatting.patch
Patch57: update-collect-plugin-period-max.patch
BuildRequires: cmake gcc-c++ BuildRequires: cmake gcc-c++
BuildRequires: python3 python3-setuptools BuildRequires: python3 python3-setuptools
@ -328,6 +329,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
* Mon Oct 21 2024 zhuofeng <zhuofeng2@huawei.com> - 1.0.2-46
- Type:bugfix
- CVE:NA
- SUG:NA
- DES:update collect plugin period max
* Mon Oct 21 2024 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.2-45 * Mon Oct 21 2024 caixiaomeng <caixiaomeng2@huawei.com> - 1.0.2-45
- Type:bugfix - Type:bugfix
- CVE:NA - CVE:NA

View File

@ -0,0 +1,44 @@
From 4550d9cbbb7e921db168f748e8b1d5d7cc0f8b15 Mon Sep 17 00:00:00 2001
From: zhuofeng <zhuofeng2@huawei.com>
Date: Mon, 21 Oct 2024 17:30:39 +0800
Subject: [PATCH] update collect plugin period max
---
src/python/sentryCollector/collect_plugin.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/python/sentryCollector/collect_plugin.py b/src/python/sentryCollector/collect_plugin.py
index 53dddec..9495d8b 100644
--- a/src/python/sentryCollector/collect_plugin.py
+++ b/src/python/sentryCollector/collect_plugin.py
@@ -45,6 +45,9 @@ LIMIT_IOTYPE_LIST_LEN = 4
LIMIT_PERIOD_MIN_LEN = 1
LIMIT_PERIOD_MAX_LEN = 300
+# max_save
+LIMIT_MAX_SAVE_LEN = 300
+
# interface protocol
class ClientProtocol():
IS_IOCOLLECT_VALID = 0
@@ -189,7 +192,7 @@ def inter_is_iocollect_valid(period, disk_list=None, stage=None):
if not period or not isinstance(period, int):
result['ret'] = ResultMessage.RESULT_NOT_PARAM
return result
- if period < LIMIT_PERIOD_MIN_LEN or period > LIMIT_PERIOD_MAX_LEN:
+ if period < LIMIT_PERIOD_MIN_LEN or period > LIMIT_PERIOD_MAX_LEN * LIMIT_MAX_SAVE_LEN:
result['ret'] = ResultMessage.RESULT_INVALID_LENGTH
return result
@@ -246,7 +249,7 @@ def inter_get_io_data(period, disk_list, stage, iotype):
if not isinstance(period, int):
result['ret'] = ResultMessage.RESULT_NOT_PARAM
return result
- if period < LIMIT_PERIOD_MIN_LEN or period > LIMIT_PERIOD_MAX_LEN:
+ if period < LIMIT_PERIOD_MIN_LEN or period > LIMIT_PERIOD_MAX_LEN * LIMIT_MAX_SAVE_LEN:
result['ret'] = ResultMessage.RESULT_INVALID_LENGTH
return result
--
2.33.0