From 88d8a3326ffa8ce046ef5ce691c91a0dacf7917b Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 18 Feb 2021 11:13:55 +0800 Subject: [PATCH] =?UTF-8?q?perf(ops):=20=E4=BC=98=E5=8C=96=E5=AE=9A?= =?UTF-8?q?=E6=9C=9F=E6=A3=80=E6=9F=A5=E7=A3=81=E7=9B=98=EF=BC=8C=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=BC=80=E5=85=B3=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/conf.py | 1 + apps/jumpserver/settings/custom.py | 4 +++- apps/ops/tasks.py | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/jumpserver/conf.py b/apps/jumpserver/conf.py index edfbae2c1..022ca84b0 100644 --- a/apps/jumpserver/conf.py +++ b/apps/jumpserver/conf.py @@ -282,6 +282,7 @@ class Config(dict): 'REFERER_CHECK_ENABLED': False, 'SERVER_REPLAY_STORAGE': {}, 'CONNECTION_TOKEN_ENABLED': False, + 'DISK_CHECK_ENABLED': True, } def compatible_auth_openid_of_key(self): diff --git a/apps/jumpserver/settings/custom.py b/apps/jumpserver/settings/custom.py index 9b4417ced..e6c121f94 100644 --- a/apps/jumpserver/settings/custom.py +++ b/apps/jumpserver/settings/custom.py @@ -116,4 +116,6 @@ DATETIME_DISPLAY_FORMAT = '%Y-%m-%d %H:%M:%S' TICKETS_ENABLED = CONFIG.TICKETS_ENABLED REFERER_CHECK_ENABLED = CONFIG.REFERER_CHECK_ENABLED -CONNECTION_TOKEN_ENABLED = CONFIG.CONNECTION_TOKEN_ENABLED \ No newline at end of file +CONNECTION_TOKEN_ENABLED = CONFIG.CONNECTION_TOKEN_ENABLED +DISK_CHECK_ENABLED = CONFIG.DISK_CHECK_ENABLED + diff --git a/apps/ops/tasks.py b/apps/ops/tasks.py index 8a5512f30..02cc9290e 100644 --- a/apps/ops/tasks.py +++ b/apps/ops/tasks.py @@ -132,6 +132,8 @@ def create_or_update_registered_periodic_tasks(): @shared_task @register_as_period_task(interval=3600) def check_server_performance_period(): + if not settings.DISK_CHECK_ENABLED: + return usages = get_disk_usage() uncheck_paths = ['/etc', '/boot']