fix ai configuration error

This commit is contained in:
wang-guangge 2022-12-19 10:54:10 +08:00
parent 669fecb290
commit edb924e83d
5 changed files with 7 additions and 102 deletions

View File

@ -1,34 +0,0 @@
From 7c959cb4b2683b23832e8a78835b57d8b9ad7bcc Mon Sep 17 00:00:00 2001
From: zhu-yuncheng <zhuyuncheng@huawei.com>
Date: Wed, 7 Dec 2022 21:43:20 +0800
Subject: [PATCH] update default model for multicheck
---
diana/core/rule/model_assign.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/diana/core/rule/model_assign.py b/diana/core/rule/model_assign.py
index 6868f99..fe24557 100644
--- a/diana/core/rule/model_assign.py
+++ b/diana/core/rule/model_assign.py
@@ -27,12 +27,12 @@ METRIC_MODEL_MAP = {
}
SCENE_MODEL_MAP = {
- "default_model": "intelligent-1", # intelligent
+ "default_model": "intelligent-for-mysql", # intelligent model for mysql
"model_info": {
- "big_data": "intelligent-1", # intelligent
- "web": "intelligent-1", # intelligent
- "edge": "intelligent-1", # intelligent
- "cloud": "intelligent-1", # intelligent
+ "big_data": "intelligent-for-mysql", # intelligent model for mysql
+ "web": "intelligent-for-mysql", # intelligent model for mysql
+ "edge": "intelligent-for-mysql", # intelligent model for mysql
+ "cloud": "intelligent-for-mysql", # intelligent model for mysql
}
}
--
2.33.0

View File

@ -1,63 +0,0 @@
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

Binary file not shown.

BIN
aops-diana-v1.1.4.tar.gz Normal file

Binary file not shown.

View File

@ -1,12 +1,10 @@
Name: aops-diana Name: aops-diana
Version: v1.1.3 Version: v1.1.4
Release: 3 Release: 1
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
Patch0002: 0002-better-ai-model-logic-and-fix-count-alert-error.patch
BuildRequires: python3-setuptools BuildRequires: python3-setuptools
@ -24,7 +22,7 @@ An intelligent abnormal detection framework of aops
%prep %prep
%autosetup -n %{name}-%{version} -p1 %autosetup -n %{name}-%{version}
# build for aops-diana # build for aops-diana
@ -40,6 +38,7 @@ An intelligent abnormal detection framework of aops
%attr(0644,root,root) %{_sysconfdir}/aops/diana.ini %attr(0644,root,root) %{_sysconfdir}/aops/diana.ini
%attr(0644,root,root) %{_sysconfdir}/aops/diana_hosts.json %attr(0644,root,root) %{_sysconfdir}/aops/diana_hosts.json
%attr(0644,root,root) %{_sysconfdir}/aops/algorithm/*.json %attr(0644,root,root) %{_sysconfdir}/aops/algorithm/*.json
%attr(0644,root,root) %{_sysconfdir}/aops/algorithm/intelligent/*
%attr(0755,root,root) %{_bindir}/aops-diana %attr(0755,root,root) %{_bindir}/aops-diana
%attr(0755,root,root) /usr/lib/systemd/system/aops-diana.service %attr(0755,root,root) /usr/lib/systemd/system/aops-diana.service
%{python3_sitelib}/aops_diana*.egg-info %{python3_sitelib}/aops_diana*.egg-info
@ -47,6 +46,9 @@ An intelligent abnormal detection framework of aops
%changelog %changelog
* Mon Dec 19 2022 wangguangge<wangguangge@huawei.com> - v1.1.4-1
- Bugfix: fix ai configuration error
* Thu Dec 8 2022 zhuyuncheng<zhuyuncheng@huawei.com> - v1.1.3-3 * Thu Dec 8 2022 zhuyuncheng<zhuyuncheng@huawei.com> - v1.1.3-3
- Bugfix: fix the alert count error - Bugfix: fix the alert count error
- Bugfix: for ai model, increase queried data length and add - Bugfix: for ai model, increase queried data length and add