From b9cbff1a5f99acbe8a5a8fe3176dd743f0af8f23 Mon Sep 17 00:00:00 2001 From: Bai Date: Fri, 11 Dec 2020 18:38:24 +0800 Subject: [PATCH] =?UTF-8?q?del:=20=E5=88=A0=E9=99=A4=E6=B5=8B=E8=AF=95prom?= =?UTF-8?q?etheus=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/settings/base.py | 3 --- apps/jumpserver/urls.py | 34 -------------------------------- 2 files changed, 37 deletions(-) diff --git a/apps/jumpserver/settings/base.py b/apps/jumpserver/settings/base.py index 252c02dd0..2a6291751 100644 --- a/apps/jumpserver/settings/base.py +++ b/apps/jumpserver/settings/base.py @@ -57,7 +57,6 @@ INSTALLED_APPS = [ 'django_filters', 'bootstrap3', 'captcha', - 'django_prometheus', 'django_celery_beat', 'django.contrib.auth', 'django.contrib.admin', @@ -70,7 +69,6 @@ INSTALLED_APPS = [ MIDDLEWARE = [ - 'django_prometheus.middleware.PrometheusBeforeMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', @@ -86,7 +84,6 @@ MIDDLEWARE = [ 'orgs.middleware.OrgMiddleware', 'authentication.backends.oidc.middleware.OIDCRefreshIDTokenMiddleware', 'authentication.backends.cas.middleware.CASMiddleware', - 'django_prometheus.middleware.PrometheusAfterMiddleware', ] diff --git a/apps/jumpserver/urls.py b/apps/jumpserver/urls.py index 0a492e073..e34c3e3a3 100644 --- a/apps/jumpserver/urls.py +++ b/apps/jumpserver/urls.py @@ -55,41 +55,7 @@ apps = [ ] -def test_metric(request): - import random - data = "" - components = ['koko', 'guacamole', 'omnidb'] - status = ['normal', 'high', 'critical', 'total'] - - data += "# JumpServer 各组件状态个数汇总\n" - for com in components: - data += f"## 组件: {com}\n" - for s in status: - key = 'jumpserver_components_status_total{component_type="%s", status="%s"}' % (com, s) - value = round(10 * random.random() * 10, 2) - data += f"{key} {value}\n" - - data += "\n# JumpServer 各组件在线会话数汇总\n" - for com in components: - for item in ['session_active']: - key = 'jumpserver_components_%s_total{component_type="%s"}' % (item, com) - value = round(40 * random.random() * 10, 2) - data += f"{key} {value}\n" - - data += "\n# JumpServer 各组件节点一些指标\n" - for item in ['cpu1_load', 'memory_used_percent', 'disk_used_percent', 'session_active']: - data += f"## 指标: {item}\n" - for com in components: - for instance in ['node1', 'node2', 'node3']: - key = 'jumpserver_components_%s{component_type="%s", component="%s"}' % (item, com, instance) - value = round(20 * random.random() * 10, 2) - data += f"{key} {value}\n" - return HttpResponse(data, content_type='text/plain; version=0.0.4; charset=utf-8') - - urlpatterns = [ - # path('prometheus/', include('django_prometheus.urls')), - path('prometheus/metrics', test_metric), path('', views.IndexView.as_view(), name='index'), path('api/v1/', include(api_v1)), path('api/v2/', include(api_v2)),