diff --git a/.idea/deployment.xml b/.idea/deployment.xml index 8f35b0c7..dcfd6e16 100644 --- a/.idea/deployment.xml +++ b/.idea/deployment.xml @@ -9,14 +9,7 @@ - - - - - - - - + diff --git a/.idea/devEops.iml b/.idea/devEops.iml index e617f5da..4e129bc4 100644 --- a/.idea/devEops.iml +++ b/.idea/devEops.iml @@ -12,7 +12,7 @@ - + diff --git a/.idea/misc.xml b/.idea/misc.xml index 97b5bd89..33144de4 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + diff --git a/.idea/remote-mappings.xml b/.idea/remote-mappings.xml index a57c9d0b..ed0a671d 100644 --- a/.idea/remote-mappings.xml +++ b/.idea/remote-mappings.xml @@ -4,6 +4,7 @@ + diff --git a/.idea/webServers.xml b/.idea/webServers.xml index 29196d71..64d82c98 100644 --- a/.idea/webServers.xml +++ b/.idea/webServers.xml @@ -2,24 +2,16 @@ - + - + - + - + - + - - - - - - - - - - - - + + + + + + + + + - - - - - + + + + + + + + + + Default + @@ -712,230 +828,6 @@ @@ -1072,7 +1188,7 @@ - + @@ -1083,34 +1199,37 @@ + - - - - - - - - - - + + + + + + + + + + - + - + - - - + + + - + - - - + + + + + @@ -1156,54 +1275,54 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - file://$PROJECT_DIR$/apitry/playbook.py - 23 + 26 file://$PROJECT_DIR$/apitry/playbook.py - 27 + 30 file://$PROJECT_DIR$/apitry/playbook.py - 32 + 35 file://$PROJECT_DIR$/apitry/playbook.py - 36 + 39 @@ -1216,11 +1335,6 @@ 8 - - file://$PROJECT_DIR$/apps/execute/api.py - 44 - file://$PROJECT_DIR$/apps/execute/service/catch/db.py 17 @@ -1231,16 +1345,6 @@ 63 - - file://$PROJECT_DIR$/apps/authority/views/user.py - 86 - - - file://$PROJECT_DIR$/apps/authority/api.py - 20 - file://$PROJECT_DIR$/apps/execute/callback/__init__.py 19 @@ -1270,16 +1374,6 @@ 58 - - file://$PROJECT_DIR$/apps/softlib/views.py - 8 - - - file://$PROJECT_DIR$/apps/application/forms.py - 60 - file://$USER_HOME$/.PyCharm2017.1/system/remote_sources/973181044/454295256/rest_framework/pagination.py 203 @@ -1310,11 +1404,6 @@ 265 - - file://$PROJECT_DIR$/apps/manager/api.py - 76 - file://$PROJECT_DIR$/apps/upload/views.py 56 @@ -1325,31 +1414,11 @@ 45 - - file://$PROJECT_DIR$/apps/utils/permission/jumper.py - 1 - - - file://$PROJECT_DIR$/apps/utils/api.py - 25 - - - file://$PROJECT_DIR$/apps/authority/models.py - 1 - file://$PROJECT_DIR$/apps/xmt/forms.py 28 - - file://$PROJECT_DIR$/apps/manager/views/host.py - 34 - file://$PROJECT_DIR$/apps/xmt/forms.py 25 @@ -1360,6 +1429,16 @@ 35 + + file://$PROJECT_DIR$/apps/manager/consumers.py + 36 + + + file://$PROJECT_DIR$/apps/ops/models.py + 36 + @@ -1371,397 +1450,441 @@ - - - - - + + - + - - + + + - + - - + + + - + - - + + + + + - + - - + + + - + - - + + + + + - + - - + + + - + - - - - - + + + + + + + + + + + - + - - + + + - + - - + + + - + - - + + + - + + + + + + + + + + - - + - - + + + - + - - + + + - + - - + + + - + - - + + + - - + - - + + + - + - - + + + - + - + + - + - - + + + - + - - + + + - + - - - - - + + + - - + + - + - - + + - + - - - - - + + + - + - - + + - + - - + + + - + - - + + - + - - - - - + + + - + - - + + - + - - + + - + - - + + - - + + - + - - + + - + - - + + - + - - - + + + + + - + - - - + + + + + - + - - - + + + + + - + - - - + + + + + - + - - - + + + + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - - + + + + + - + - - - + + + + + - + - - + + - + - - + + - + - - - + + + + + diff --git a/apps/dashboard/api/expired.py b/apps/dashboard/api/expired.py index 30f2f745..ae2f5f4e 100644 --- a/apps/dashboard/api/expired.py +++ b/apps/dashboard/api/expired.py @@ -28,7 +28,7 @@ class ExpiredPagination(PageNumberPagination): class DashboardExpiredECSAPI(WebTokenAuthentication,generics.ListAPIView): module = models.ExpiredAliyunECS permission_classes = [AllowAny,] - queryset = models.ExpiredAliyunECS.objects.all().order_by('expired') + queryset = models.ExpiredAliyunECS.objects.all() serializer_class = serializers.DashboardExpiredAliyunECSSerializer pagination_class = ExpiredPagination @@ -36,6 +36,6 @@ class DashboardExpiredECSAPI(WebTokenAuthentication,generics.ListAPIView): class DashboardExpiredRDSAPI(WebTokenAuthentication,generics.ListAPIView): module = models.ExpiredAliyunRDS permission_classes = [AllowAny,] - queryset = models.ExpiredAliyunRDS.objects.all().order_by('expired') + queryset = models.ExpiredAliyunRDS.objects.all() serializer_class = serializers.DashboardExpiredAliyunRDSSerializer pagination_class = ExpiredPagination \ No newline at end of file diff --git a/apps/dashboard/tasks.py b/apps/dashboard/tasks.py index 6f605ee7..60d11e3e 100644 --- a/apps/dashboard/tasks.py +++ b/apps/dashboard/tasks.py @@ -15,7 +15,6 @@ connect = redis.StrictRedis(port=REDIS_PORT,db=REDIS_SPACE) - @periodic_task(run_every=crontab(minute='*')) def aliyunECSExpiredInfoCatch(): from dashboard.models import ExpiredAliyunECS @@ -48,4 +47,30 @@ def aliyunRDSInfoCatch(): expiredTime = datetime.datetime.strptime(dt['ExpireTime'],'%Y-%m-%dT%H:%M:%SZ') if 0 < (expiredTime - now).days < EXPIREDTIME: dt['ExpiredDay'] = (expiredTime - now).days - ExpiredAliyunRDS(**resolver.AliyunRDS2Json.decode(dt)).save() \ No newline at end of file + ExpiredAliyunRDS(**resolver.AliyunRDS2Json.decode(dt)).save() + + +@periodic_task(run_every=crontab(minute='*')) +def managerStatusCatch(): + connect.delete('MANAGER_STATUS') + from manager import models as Manager + host_count = Manager.Host.objects.count() + group_count = Manager.Group.objects.count() + status = { + 'host_count':host_count, + 'group_count':group_count, + } + systypes = Manager.System_Type.objects.all() + for sys in systypes: + status[sys.name] = sys.hosts_detail.count() + + positions = Manager.Position.objects.all() + for pos in positions: + status['pos'+str(pos.id)] = pos.hosts_detail.count() + + groups = Manager.Group.objects.all() + for group in groups: + status[group.uuid] = group.hosts.count() + + connect.hmset('MANAGER_STATUS', status) + diff --git a/apps/dashboard/urls/api_urls.py b/apps/dashboard/urls/api_urls.py index 57bca2ec..1bd08919 100644 --- a/apps/dashboard/urls/api_urls.py +++ b/apps/dashboard/urls/api_urls.py @@ -4,7 +4,7 @@ urlpatterns=[ # Resource dashboard api - path(r'v1/dashboard/', DashboardAPI.DashboardAPI.as_view()), + path(r'v1/manager/', DashboardAPI.DashboardAPI.as_view()), # # Resource expire api path(r'v1/expired/ecs/bypage/', ExpiredAPI.DashboardExpiredECSAPI.as_view()), diff --git a/apps/manager/tasks.py b/apps/manager/tasks.py index 0bd3e469..2268e83c 100644 --- a/apps/manager/tasks.py +++ b/apps/manager/tasks.py @@ -14,31 +14,6 @@ connect = redis.StrictRedis(port=REDIS_PORT,db=REDIS_SPACE) -@periodic_task(run_every=crontab(minute='*')) -def managerStatusCatch(): - connect.delete('MANAGER_STATUS') - from manager import models as Manager - host_count = Manager.Host.objects.count() - group_count = Manager.Group.objects.count() - status = { - 'host_count':host_count, - 'group_count':group_count, - } - systypes = Manager.System_Type.objects.all() - for sys in systypes: - status[sys.name] = sys.hosts_detail.count() - - positions = Manager.Position.objects.all() - for pos in positions: - status['pos'+str(pos.id)] = pos.hosts_detail.count() - - groups = Manager.Group.objects.all() - for group in groups: - status[group.uuid] = group.hosts.count() - - connect.hmset('MANAGER_STATUS', status) - - # @periodic_task(run_every=crontab(minute='*')) # def aliyunECSInfoCatch(): # from deveops.utils import aliyun