1 Star 0 Fork 19

PshySimon/sysSentry_xalarm_service

forked from src-openEuler/sysSentry 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Fix-the-problem-that-function-cpu_report_result-is-c.patch 1.39 KB
一键复制 编辑 原始数据 按行查看 历史
From 3e2721852ad1f8047ad219a5ab6c68fd4c9d6f5c Mon Sep 17 00:00:00 2001
From: shixuantong <shixuantong1@huawei.com>
Date: Wed, 24 Jul 2024 16:17:54 +0800
Subject: [PATCH] Fix the problem that function cpu_report_result() is called
more than once
when task is running, user to exec "sentryctl stop cpu_sentry", cpu_report_result() will be called twice. This will cause the log to be printed twice
---
src/python/syssentry/cpu_sentry.py | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/python/syssentry/cpu_sentry.py b/src/python/syssentry/cpu_sentry.py
index 7e77654..3c4d58d 100644
--- a/src/python/syssentry/cpu_sentry.py
+++ b/src/python/syssentry/cpu_sentry.py
@@ -133,6 +133,7 @@ class CpuSentry:
result_level = self.send_result.get("result", ResultLevel.FAIL)
report_result(task_name, result_level, details)
+ self.init_send_result()
def kill_process(signum, _f, cpu_sentry_obj):
"""kill process by 'pkill -9'"""
@@ -179,6 +180,6 @@ def main():
cpu_sentry_task.send_result["result"] = ResultLevel.FAIL
cpu_sentry_task.send_result["details"]["code"] = 1004
cpu_sentry_task.send_result["details"]["msg"] = "run cmd [%s] raise Error" % cpu_sentry_task_cmd
- finally:
cpu_sentry_task.cpu_report_result()
- cpu_sentry_task.init_send_result()
+ else:
+ cpu_sentry_task.cpu_report_result()
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pshysimon/sysSentry_xalarm_service.git
git@gitee.com:pshysimon/sysSentry_xalarm_service.git
pshysimon
sysSentry_xalarm_service
sysSentry_xalarm_service
master

搜索帮助