1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-11-01 03:54:15 +00:00

add host status checking for statistic request

This commit is contained in:
catborise 2020-05-19 00:38:20 +03:00 committed by catborise
parent 0c72ccd066
commit 566a9d446a
2 changed files with 24 additions and 22 deletions

View file

@ -226,7 +226,7 @@
} }
} }
}); });
if (Boolean({{ status }}) === true) {
window.setInterval(function graph_usage() { window.setInterval(function graph_usage() {
$.getJSON('{% url 'compute_graph' compute_id %}', function (data) { $.getJSON('{% url 'compute_graph' compute_id %}', function (data) {
cpuChart.data.labels.push(data.timeline); cpuChart.data.labels.push(data.timeline);
@ -250,5 +250,6 @@
memChart.update(); memChart.update();
}); });
}, 5000); }, 5000);
}
</script> </script>
{% endblock %} {% endblock %}

View file

@ -86,6 +86,7 @@ def overview(request, compute_id):
error_messages = [] error_messages = []
compute = get_object_or_404(Compute, pk=compute_id) compute = get_object_or_404(Compute, pk=compute_id)
status = 'true' if connection_manager.host_is_up(compute.type, compute.hostname) else 'false'
try: try:
conn = wvmHostDetails( conn = wvmHostDetails(