Browse Source

perf(ops): 优化定期检查磁盘,添加开关控制

pull/5592/head^2
ibuler 4 years ago committed by 老广
parent
commit
88d8a3326f
  1. 1
      apps/jumpserver/conf.py
  2. 4
      apps/jumpserver/settings/custom.py
  3. 2
      apps/ops/tasks.py

1
apps/jumpserver/conf.py

@ -282,6 +282,7 @@ class Config(dict):
'REFERER_CHECK_ENABLED': False, 'REFERER_CHECK_ENABLED': False,
'SERVER_REPLAY_STORAGE': {}, 'SERVER_REPLAY_STORAGE': {},
'CONNECTION_TOKEN_ENABLED': False, 'CONNECTION_TOKEN_ENABLED': False,
'DISK_CHECK_ENABLED': True,
} }
def compatible_auth_openid_of_key(self): def compatible_auth_openid_of_key(self):

4
apps/jumpserver/settings/custom.py

@ -116,4 +116,6 @@ DATETIME_DISPLAY_FORMAT = '%Y-%m-%d %H:%M:%S'
TICKETS_ENABLED = CONFIG.TICKETS_ENABLED TICKETS_ENABLED = CONFIG.TICKETS_ENABLED
REFERER_CHECK_ENABLED = CONFIG.REFERER_CHECK_ENABLED REFERER_CHECK_ENABLED = CONFIG.REFERER_CHECK_ENABLED
CONNECTION_TOKEN_ENABLED = CONFIG.CONNECTION_TOKEN_ENABLED CONNECTION_TOKEN_ENABLED = CONFIG.CONNECTION_TOKEN_ENABLED
DISK_CHECK_ENABLED = CONFIG.DISK_CHECK_ENABLED

2
apps/ops/tasks.py

@ -132,6 +132,8 @@ def create_or_update_registered_periodic_tasks():
@shared_task @shared_task
@register_as_period_task(interval=3600) @register_as_period_task(interval=3600)
def check_server_performance_period(): def check_server_performance_period():
if not settings.DISK_CHECK_ENABLED:
return
usages = get_disk_usage() usages = get_disk_usage()
uncheck_paths = ['/etc', '/boot'] uncheck_paths = ['/etc', '/boot']

Loading…
Cancel
Save