summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author尹姜谊 <[email protected]>2024-04-17 15:26:34 +0800
committer尹姜谊 <[email protected]>2024-04-17 15:26:34 +0800
commit1cc37ec84e68c6b86f9c8c466b9c93ee2341727e (patch)
tree9da5de1dc937ec12f44083bec156801dbc6cde8b
parent9bcbf880bb5252b023797ee1efd371ee9c34fd50 (diff)
Fix: 修复监控问题
-rw-r--r--detection/knowledgebase_monitor.py4
-rw-r--r--detection/tool/KnowledgeBaseTool.py4
-rw-r--r--detection/tool/__pycache__/KnowledgeBaseTool.cpython-39.pycbin3521 -> 3537 bytes
3 files changed, 5 insertions, 3 deletions
diff --git a/detection/knowledgebase_monitor.py b/detection/knowledgebase_monitor.py
index 5dd2e83..0a0dbb9 100644
--- a/detection/knowledgebase_monitor.py
+++ b/detection/knowledgebase_monitor.py
@@ -176,12 +176,12 @@ if __name__ == '__main__':
end_time = datetime.datetime.now().strftime("%Y-%m-%d %H:00:00")
start_time = (datetime.datetime.now() - datetime.timedelta(hours=recent_interval)).strftime("%Y-%m-%d %H:00:00")
- monitor_result_dict.update(monitor.calculate_vpn_monitor_recent_mode(vpn_service=None))
+ monitor_result_dict.update(monitor.calculate_vpn_monitor_recent_mode(vpn_service=None, recent_interval_h=recent_interval))
vpn_service_name_list = []
for plugin_name in config_dict:
if 'vpn' in plugin_name and 'vpn_service_name' in config_dict[plugin_name]:
vpn_service_name = config_dict[plugin_name]['vpn_service_name']
- monitor_result_dict.update(monitor.calculate_vpn_monitor_recent_mode(vpn_service=vpn_service_name))
+ monitor_result_dict.update(monitor.calculate_vpn_monitor_recent_mode(vpn_service=vpn_service_name, recent_interval_h=recent_interval))
# save to prom file
monitor_file = monitor.monitor_config['monitor_file_path']
diff --git a/detection/tool/KnowledgeBaseTool.py b/detection/tool/KnowledgeBaseTool.py
index bdf6328..a8079d4 100644
--- a/detection/tool/KnowledgeBaseTool.py
+++ b/detection/tool/KnowledgeBaseTool.py
@@ -102,12 +102,14 @@ class KnowledgeApi:
def get_knowledgebase_count(self, knowledge_id, page_size=None, page_no=None, q=None):
url = 'http://' + self.api_address + '/v1/knowledgeBase/' + str(knowledge_id)
+ q = quote(q, 'utf-8')
param = {
- "q": quote(q, 'utf-8'),
"pageNo": page_no,
"pageSize": page_size
}
+ url += ('?q=' + q)
+
header = {
"Cn-Authorization": self.api_token
}
diff --git a/detection/tool/__pycache__/KnowledgeBaseTool.cpython-39.pyc b/detection/tool/__pycache__/KnowledgeBaseTool.cpython-39.pyc
index 82af915..87a4e19 100644
--- a/detection/tool/__pycache__/KnowledgeBaseTool.cpython-39.pyc
+++ b/detection/tool/__pycache__/KnowledgeBaseTool.cpython-39.pyc
Binary files differ