Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Health check alerts in Teletraan with Runbook info #1223

Merged
merged 4 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions deploy-board/deploy_board/templates/groups/group_config.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,24 @@
</span>
</div>
</div>
<label for="runbook_link" class="deployToolTip control-label col-xs-2"
data-toggle="tooltip"
title="Enter the link to the runbook need for any any healthcheck failure alerts">
Runbook Link
</label>
<div class="col-xs-4">
<div class="input-group">
<input class="form-control" id="runbook_link" name="runbook_link" required="false"
type="text" value="{{ config.runbookLink |default_if_none:'' }}"/>
<span class="input-group-btn">
<button id="runbooklinkExpressionId" class="deployToolTip btn btn-default"
type="button" data-toggle="tooltip"
title="click for more information on the runbook link">
<span class="glyphicon glyphicon-question-sign"></span>
</button>
</span>
</div>
</div>
</div>
<div class="form-group collapse" id="loadbalancersExpressionDetailsId">
<div class="col-xs-2">
Expand All @@ -208,6 +226,13 @@
Please enter the load balancers you would like to attach to this group seperated by commas.
</div>
</div>
<div class="form-group collapse" id="runbooklinkExpressionDetailsId">
<div class="col-xs-8">
</div>
<div class="col-xs-4">
Please enter the runbook link that you would like to attach to health check failure messages.
</div>
</div>
<div class="form-group">
<label for="target_groups" class="deployToolTip control-label col-xs-2"
data-toggle="tooltip"
Expand Down Expand Up @@ -339,5 +364,8 @@
$("#targetgroupsExpressionId").click(function() {
$("#targetgroupsExpressionDetailsId").collapse('toggle');
});
$("#runbooklinkExpressionId").click(function() {
$("#runbooklinkExpressionDetailsId").collapse('toggle');
});
Comment on lines +367 to +369
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

non-blocking. This and all above can share the same class and this only need to apply to the class once.

});
</script>
23 changes: 12 additions & 11 deletions deploy-board/deploy_board/webapp/group_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,34 @@ def group_landing(request):
"disablePrevious": index <= 1,
"disableNext": len(group_names) < DEFAULT_PAGE_SIZE,
})


def get_group_names(request):
index = int(request.GET.get('page_index', '1'))
size = int(request.GET.get('page_size', DEFAULT_PAGE_SIZE))
group_names = autoscaling_groups_helper.get_env_group_names(request, index, size)
return HttpResponse(json.dumps(group_names), content_type="application/json")


def search_groups(request, group_name):
index = int(request.GET.get('page_index', '1'))
size = int(request.GET.get('page_size', DEFAULT_PAGE_SIZE))
group_names = autoscaling_groups_helper.get_env_group_names(request, index, size, name_filter=group_name)

if not group_names:
return redirect('/groups/')

if len(group_names) == 1:
return redirect('/groups/%s/' % group_names[0])

return render(request, 'groups/group_landing.html', {
"group_names": group_names,
"pageIndex": index,
"pageSize": DEFAULT_PAGE_SIZE,
"disablePrevious": index <= 1,
"disableNext": len(group_names) < DEFAULT_PAGE_SIZE,
})


def get_system_specs(request):
instance_types = specs_helper.get_instance_types(request)
Expand Down Expand Up @@ -265,6 +265,7 @@ def update_group_config(request, group_name):
groupRequest["launchLatencyTh"] = int(params["launch_latency_th"]) * 60
groupRequest["loadBalancers"] = params.get("load_balancers")
groupRequest["targetGroups"] = params.get("target_groups")
groupRequest["runbookLink"] = params.get("runbook_link")

if "healthcheck_state" in params:
groupRequest["healthcheckState"] = True
Expand Down Expand Up @@ -1269,9 +1270,9 @@ def disable_scaling_down_event(request, group_name):

def add_scheduled_actions(request, group_name):
params = request.POST

# validate scheduled capacity against ASG config minimum and maximum size
asg_summary = autoscaling_groups_helper.get_autoscaling_summary(request, group_name)
asg_summary = autoscaling_groups_helper.get_autoscaling_summary(request, group_name)
asg_minsize = int(asg_summary.get("minSize", -1))
asg_maxsize = int(asg_summary.get("maxSize", -1)) # invalid value indicates no need to check

Expand All @@ -1286,7 +1287,7 @@ def add_scheduled_actions(request, group_name):
schedule_action['clusterName'] = group_name
schedule_action['schedule'] = params['schedule']
schedule_action['capacity'] = params['capacity']

autoscaling_groups_helper.add_scheduled_actions(request, group_name, [schedule_action])
except:
log.error(traceback.format_exc())
Expand Down Expand Up @@ -1335,8 +1336,8 @@ def update_scheduled_actions(request, group_name):
except:
log.error(traceback.format_exc())
return HttpResponse(json.dumps({'content': ""}), content_type="application/json")


def get_terminating_hosts_by_group(request, group_name):
data = groups_helper.get_terminating_by_group(request, group_name)
return HttpResponse(json.dumps(data), content_type="application/json")
Loading