sysSentry/update-collect-plugin-period-max.patch
2024-10-21 19:25:51 +08:00

45 lines
1.6 KiB
Diff

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