uniform plugins log

Signed-off-by: jinsaihang <jinsaihang@h-partners.com>
This commit is contained in:
jinsaihang 2024-12-18 17:25:57 +08:00
parent 0fe480bf25
commit 48704857e2
2 changed files with 72 additions and 2 deletions

View File

@ -4,7 +4,7 @@
Summary: System Inspection Framework
Name: sysSentry
Version: 1.0.2
Release: 63
Release: 64
License: Mulan PSL v2
Group: System Environment/Daemons
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
@ -85,6 +85,7 @@ Patch72: update-nvme-config.patch
Patch73: make-debug-msg-clear.patch
Patch74: add-boundary-check-for-settings.patch
Patch75: change-status-of-period-task-and-sort-mod-file.patch
Patch76: uniform-avg_block_io-log-and-ai_block_io-log.patch
BuildRequires: cmake gcc-c++
BuildRequires: python3 python3-setuptools
@ -382,6 +383,12 @@ rm -rf %{buildroot}
%attr(0550,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py
%changelog
* Wed Dec 18 2024 jinsaihang <jinsaihang@h-partners.com> - 1.0.2-64
- Type:bugfix
- CVE:NA
- SUG:NA
- DESC:uniform plugins log
* Fri Dec 13 2024 zhuofeng <zhuofeng2@huawei.com> - 1.0.2-63
- Type:bugfix
- CVE:NA
@ -436,7 +443,7 @@ rm -rf %{buildroot}
- SUG:NA
- DES:modify logrotate rule
* Tue Oct 29 2024 jinsaihang <jinsaihang@h-partners.com> - 1.0.2-54
* Wed Oct 30 2024 jinsaihang <jinsaihang@h-partners.com> - 1.0.2-54
- Type:bugfix
- CVE:NA
- SUG:NA

View File

@ -0,0 +1,63 @@
From c8f21d1621e96e2c8a239f8028cc9331aa0f8997 Mon Sep 17 00:00:00 2001
From: jinsaihang <jinsaihang@h-partners.com>
Date: Tue, 17 Dec 2024 11:36:11 +0800
Subject: [PATCH] uniform avg_block_io log and ai_block_io log
Signed-off-by: jinsaihang <jinsaihang@h-partners.com>
---
src/python/sentryPlugins/ai_block_io/ai_block_io.py | 5 +++++
src/python/sentryPlugins/ai_block_io/detector.py | 8 +++-----
src/python/sentryPlugins/avg_block_io/stage_window.py | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/python/sentryPlugins/ai_block_io/ai_block_io.py b/src/python/sentryPlugins/ai_block_io/ai_block_io.py
index 14f740d..8075f5f 100644
--- a/src/python/sentryPlugins/ai_block_io/ai_block_io.py
+++ b/src/python/sentryPlugins/ai_block_io/ai_block_io.py
@@ -208,6 +208,11 @@ class SlowIODetection:
tmp_alarm_content = alarm_content.copy()
del tmp_alarm_content["details"]
logging.warning("[SLOW IO] " + str(tmp_alarm_content))
+ logging.warning(f'[SLOW IO] disk: {str(tmp_alarm_content.get("driver_name"))}, '
+ f'stage: {str(tmp_alarm_content.get("driver_name"))}, '
+ f'iotype: {str(tmp_alarm_content.get("io_type"))}, '
+ f'type: {str(tmp_alarm_content.get("alarm_type"))}, '
+ f'reason: {str(tmp_alarm_content.get("reason"))}')
logging.warning(f"latency: " + str(alarm_content.get("details").get("latency")))
logging.warning(f"iodump: " + str(alarm_content.get("details").get("iodump")))
diff --git a/src/python/sentryPlugins/ai_block_io/detector.py b/src/python/sentryPlugins/ai_block_io/detector.py
index 496e032..27fb7f7 100644
--- a/src/python/sentryPlugins/ai_block_io/detector.py
+++ b/src/python/sentryPlugins/ai_block_io/detector.py
@@ -58,11 +58,9 @@ class Detector:
logging.info(f'[abnormal_period]: disk: {self._metric_name.disk_name}, '
f'stage: {self._metric_name.stage_name}, '
f'iotype: {self._metric_name.io_access_type_name}, '
- f'metric: {self._metric_name.metric_name}, '
- f'current value: {metric_value}, '
- f'ai threshold: {detection_result[2]}, '
- f'absolute threshold upper limit: {detection_result[3]}, '
- f'lower limit: {detection_result[4]}')
+ f'type: {self._metric_name.metric_name}, '
+ f'ai_threshold: {round(detection_result[2], 3)}, '
+ f'curr_val: {metric_value}')
else:
logging.debug(f'Detection result: {str(detection_result)}')
logging.debug(f'exit Detector: {self}')
diff --git a/src/python/sentryPlugins/avg_block_io/stage_window.py b/src/python/sentryPlugins/avg_block_io/stage_window.py
index 5113782..587bd49 100644
--- a/src/python/sentryPlugins/avg_block_io/stage_window.py
+++ b/src/python/sentryPlugins/avg_block_io/stage_window.py
@@ -28,7 +28,7 @@ class AbnormalWindowBase:
self.abnormal_window.append(False)
def is_abnormal_window(self):
- return sum(self.abnormal_window) > self.window_threshold
+ return sum(self.abnormal_window) >= self.window_threshold
def window_data_to_string(self):
return ",".join(str(x) for x in self.window_data)
--
2.27.0