better ai model logic and fix alert count error
This commit is contained in:
parent
8a072bfaa4
commit
f267adc5e0
63
0002-better-ai-model-logic-and-fix-count-alert-error.patch
Normal file
63
0002-better-ai-model-logic-and-fix-count-alert-error.patch
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
From 36de2919c2d9f6ea3bc893ec7d0e72750b1e4805 Mon Sep 17 00:00:00 2001
|
||||||
|
From: zhu-yuncheng <zhuyuncheng@huawei.com>
|
||||||
|
Date: Thu, 8 Dec 2022 22:01:31 +0800
|
||||||
|
Subject: [PATCH] better ai model logic and fix count alert error
|
||||||
|
|
||||||
|
---
|
||||||
|
.../experiment/algorithm/multi_item_check/intelligent.py | 8 +++++++-
|
||||||
|
diana/core/rule/workflow.py | 2 +-
|
||||||
|
diana/database/dao/result_dao.py | 3 +--
|
||||||
|
3 files changed, 9 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/diana/core/experiment/algorithm/multi_item_check/intelligent.py b/diana/core/experiment/algorithm/multi_item_check/intelligent.py
|
||||||
|
index fc4b223..c96f011 100644
|
||||||
|
--- a/diana/core/experiment/algorithm/multi_item_check/intelligent.py
|
||||||
|
+++ b/diana/core/experiment/algorithm/multi_item_check/intelligent.py
|
||||||
|
@@ -125,7 +125,13 @@ class Intelligent(BaseMultiItemAlgorithmTwo):
|
||||||
|
if fusion_strategy == 'intersection':
|
||||||
|
for column in concat_result.columns:
|
||||||
|
concat_result['total'] = concat_result['total'] & concat_result[column]
|
||||||
|
- if concat_result[concat_result['total'] == True].shape[0] > 0:
|
||||||
|
+
|
||||||
|
+ time = pd.to_datetime(time_range[1] - 600, unit='s')
|
||||||
|
+ index = concat_result.index
|
||||||
|
+ select_index = index[index > time]
|
||||||
|
+ select_result = concat_result.loc[select_index]
|
||||||
|
+
|
||||||
|
+ if select_result[select_result['total'] == True].shape[0] > 0:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
diff --git a/diana/core/rule/workflow.py b/diana/core/rule/workflow.py
|
||||||
|
index 475378e..47df2f8 100644
|
||||||
|
--- a/diana/core/rule/workflow.py
|
||||||
|
+++ b/diana/core/rule/workflow.py
|
||||||
|
@@ -205,7 +205,7 @@ class Workflow:
|
||||||
|
return DATABASE_CONNECT_ERROR
|
||||||
|
|
||||||
|
# data time range should based on the algorithm in the future
|
||||||
|
- data_time_range = [time_range[1]-900, time_range[1]]
|
||||||
|
+ data_time_range = [time_range[1]-1500, time_range[1]]
|
||||||
|
data_status, monitor_data = data_dao.query_data(
|
||||||
|
time_range=data_time_range, host_list=hosts)
|
||||||
|
|
||||||
|
diff --git a/diana/database/dao/result_dao.py b/diana/database/dao/result_dao.py
|
||||||
|
index 347e2c5..45428d6 100644
|
||||||
|
--- a/diana/database/dao/result_dao.py
|
||||||
|
+++ b/diana/database/dao/result_dao.py
|
||||||
|
@@ -306,11 +306,10 @@ class ResultDao(MysqlProxy):
|
||||||
|
try:
|
||||||
|
fliters = {
|
||||||
|
DomainCheckResult.username == data['username'],
|
||||||
|
- DomainCheckResult.alert_id == AlertHost.alert_id,
|
||||||
|
DomainCheckResult.confirmed == 0
|
||||||
|
}
|
||||||
|
alert_count_query = self.session.query(
|
||||||
|
- func.count(AlertHost.alert_id)).filter(*fliters).scalar()
|
||||||
|
+ func.count(DomainCheckResult.alert_id)).filter(*fliters).scalar()
|
||||||
|
|
||||||
|
except SQLAlchemyError as error:
|
||||||
|
LOGGER.error(error)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,11 +1,12 @@
|
|||||||
Name: aops-diana
|
Name: aops-diana
|
||||||
Version: v1.1.3
|
Version: v1.1.3
|
||||||
Release: 2
|
Release: 3
|
||||||
Summary: An intelligent abnormal detection framework of aops
|
Summary: An intelligent abnormal detection framework of aops
|
||||||
License: MulanPSL2
|
License: MulanPSL2
|
||||||
URL: https://gitee.com/openeuler/%{name}
|
URL: https://gitee.com/openeuler/%{name}
|
||||||
Source0: %{name}-%{version}.tar.gz
|
Source0: %{name}-%{version}.tar.gz
|
||||||
Patch0001: 0001-update-default-model-for-multicheck.patch
|
Patch0001: 0001-update-default-model-for-multicheck.patch
|
||||||
|
Patch0002: 0002-better-ai-model-logic-and-fix-count-alert-error.patch
|
||||||
|
|
||||||
|
|
||||||
BuildRequires: python3-setuptools
|
BuildRequires: python3-setuptools
|
||||||
@ -46,6 +47,11 @@ An intelligent abnormal detection framework of aops
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Dec 8 2022 zhuyuncheng<zhuyuncheng@huawei.com> - v1.1.3-3
|
||||||
|
- Bugfix: fix the alert count error
|
||||||
|
- Bugfix: for ai model, increase queried data length and add
|
||||||
|
a time range for error judgment.
|
||||||
|
|
||||||
* Wed Dec 7 2022 zhuyuncheng<zhuyuncheng@huawei.com> - v1.1.3-2
|
* Wed Dec 7 2022 zhuyuncheng<zhuyuncheng@huawei.com> - v1.1.3-2
|
||||||
- Change default multicheck model
|
- Change default multicheck model
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user