From 6cf98a207184d9a6b0688d22391a2d40dabb4851 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 9 Oct 2024 15:58:52 +0800 Subject: [PATCH] ebpf change time from ms to us --- ebpf-change-ms-to-us-in-threshold.patch | 67 +++++++++++++++++++++++++ sysSentry.spec | 9 +++- 2 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 ebpf-change-ms-to-us-in-threshold.patch diff --git a/ebpf-change-ms-to-us-in-threshold.patch b/ebpf-change-ms-to-us-in-threshold.patch new file mode 100644 index 0000000..b711ea0 --- /dev/null +++ b/ebpf-change-ms-to-us-in-threshold.patch @@ -0,0 +1,67 @@ +From 977864f20a3787dadae661819343fa677f5ca4e8 Mon Sep 17 00:00:00 2001 +From: zhangnan +Date: Wed, 9 Oct 2024 15:44:29 +0800 +Subject: [PATCH] change ms to us in threshold + +--- + src/python/sentryCollector/collect_io.py | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/src/python/sentryCollector/collect_io.py b/src/python/sentryCollector/collect_io.py +index e45947a..ff50cfe 100644 +--- a/src/python/sentryCollector/collect_io.py ++++ b/src/python/sentryCollector/collect_io.py +@@ -254,6 +254,8 @@ class CollectIo(): + if EBPF_GLOBAL_DATA: + for data in EBPF_GLOBAL_DATA: + data_list = data.split() ++ if len(data_list) != 6: ++ continue + stage, finish_count, latency, io_dump, io_type ,disk_name = data_list + if disk_name not in self.window_value: + continue +@@ -327,7 +329,7 @@ class CollectIo(): + lat_time = curr_latency - prev_latency + if finish <= 0 or lat_time <= 0: + return 0 +- value = lat_time / finish / 1000 / 1000 ++ value = lat_time / finish / 1000 + if value.is_integer(): + return int(value) + else: +@@ -341,7 +343,7 @@ class CollectIo(): + finish = curr_finish_count - prev_finish_count + if finish <= 0: + return 0 +- value = finish / self.period_time / 1000 / 1000 ++ value = finish / self.period_time + if value.is_integer(): + return int(value) + else: +@@ -355,7 +357,7 @@ class CollectIo(): + lat_time = curr_latency - prev_latency + if lat_time <= 0: + return 0 +- value = lat_time / self.period_time ++ value = lat_time / self.period_time / 1000 + if value.is_integer(): + return int(value) + else: +@@ -423,6 +425,7 @@ class CollectIo(): + sleep_time -= 1 + time.sleep(sleep_time) + elif self.is_ebpf_avaliable(): ++ logging.info("ebpf collector thread start") + self.start_ebpf_subprocess() + + thread_get_data = threading.Thread(target=self.get_ebpf_raw_data) +@@ -438,7 +441,6 @@ class CollectIo(): + thread_append_data.join() + + self.stop_ebpf_subprocess() +- logging.info("ebpf collector thread exits") + else: + logging.warning("fail to start ebpf collector thread. collect io thread exits") + return +-- +2.33.0 diff --git a/sysSentry.spec b/sysSentry.spec index 4d98b19..4337033 100644 --- a/sysSentry.spec +++ b/sysSentry.spec @@ -4,7 +4,7 @@ Summary: System Inspection Framework Name: sysSentry Version: 1.0.2 -Release: 23 +Release: 24 License: Mulan PSL v2 Group: System Environment/Daemons Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz @@ -34,6 +34,7 @@ Patch21: add-pyxalarm-and-pySentryNotify-add-multi-users-supp.patch Patch22: add-sentryctl-get_alarm-module_name-s-time_range-d.patch Patch23: fix-python-3.7-not-support-list-bool-type.patch Patch24: avg_block_io-send-alarm-to-xalarmd.patch +Patch25: ebpf-change-ms-to-us-in-threshold.patch BuildRequires: cmake gcc-c++ BuildRequires: python3 python3-setuptools @@ -286,6 +287,12 @@ rm -rf %{buildroot} %attr(0550,root,root) %{python3_sitelib}/sentryPlugins/ai_block_io %changelog +* Wed Oct 9 2024 zhangnan - 1.0.2-24 +- Type:bugfix +- CVE:NA +- SUG:NA +- DESC:change time from ms to us + * Wed Oct 9 2024 zhuofeng - 1.0.2-23 - Type:bugfix - CVE:NA -- Gitee