Environments
diff --git a/deploy-board/deploy_board/templates/groups/host_az_dist.tmpl b/deploy-board/deploy_board/templates/groups/host_az_dist.tmpl
new file mode 100644
index 0000000000..a5c4fe866f
--- /dev/null
+++ b/deploy-board/deploy_board/templates/groups/host_az_dist.tmpl
@@ -0,0 +1,31 @@
+{% load utils %}
+
+{% block content %}
+
+
Host Distribution Among Availability Zones
+
+
+
+
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/deploy-board/deploy_board/webapp/arcee_urls.py b/deploy-board/deploy_board/webapp/arcee_urls.py
index 6e5536918b..e4d2b49b3d 100644
--- a/deploy-board/deploy_board/webapp/arcee_urls.py
+++ b/deploy-board/deploy_board/webapp/arcee_urls.py
@@ -67,6 +67,7 @@
url(r'^groups/names', group_view.get_group_names),
url(r'^groups/search/(?P
[a-zA-Z0-9\-_]+)/$', group_view.search_groups),
url(r'^groups/search/$', group_view.group_landing),
+ url(r'^groups/(?P[a-zA-Z0-9\-_]+)/host-az-dist/$', group_view.get_host_az_dist),
url(r'^groups/(?P[a-zA-Z0-9\-_]+)/$', group_view.GroupDetailView.as_view()),
url(r'^groups/(?P[a-zA-Z0-9\-_]+)/config/$', group_view.GroupConfigView.as_view()),
url(r'^groups/(?P[a-zA-Z0-9\-_]+)/envs/', group_view.get_envs),
diff --git a/deploy-board/deploy_board/webapp/group_view.py b/deploy-board/deploy_board/webapp/group_view.py
index 3e952c2f39..a284ee0dad 100644
--- a/deploy-board/deploy_board/webapp/group_view.py
+++ b/deploy-board/deploy_board/webapp/group_view.py
@@ -13,7 +13,7 @@
# limitations under the License.
-from deploy_board.settings import IS_PINTEREST, PHOBOS_URL
+from deploy_board.settings import CMDB_API_HOST, IS_PINTEREST, PHOBOS_URL
from django.middleware.csrf import get_token
from django.shortcuts import render, redirect
from django.views.generic import View
@@ -21,7 +21,9 @@
from django.http import HttpResponse
from django.contrib import messages
from django.contrib.messages import get_messages
+from collections import Counter
import json
+import requests
import logging
import traceback
from itertools import groupby
@@ -1464,6 +1466,20 @@ def get_health_check_activities(request, group_name):
})
+def get_host_az_dist(request, group_name):
+ host_az_dist = requests.post(url = CMDB_API_HOST+"/v2/query", json={
+ "query": "tags.Autoscaling:{} AND state:running".format(group_name),
+ "fields": "location"
+ }
+ )
+
+ counter = Counter([x['location'] for x in host_az_dist.json()])
+
+ return render(request, 'groups/host_az_dist.tmpl', {
+ 'labels': list(counter.keys()),
+ 'data': list(counter.values()),
+ })
+
def get_health_check_details(request, id):
health_check = autoscaling_groups_helper.get_health_check(request, id)
env = environs_helper.get(request, health_check.get('env_id'))