This repository has been archived by the owner on May 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from imotai/master
已经上线验证,支持多个数据中心trace展示
- Loading branch information
Showing
11 changed files
with
246 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<h4>{{}}</h4> | ||
|
||
<div class="ui four statistics"> | ||
<div class="statistic"> | ||
<div class="value"> | ||
{{agent_total}} | ||
</div> | ||
<div class="label"> | ||
机器总数 | ||
</div> | ||
</div> | ||
<div class="statistic"> | ||
<div class="value"> | ||
{{cpu_total}} | ||
</div> | ||
<div class="label"> | ||
总cpu核数 | ||
</div> | ||
</div> | ||
<div class="statistic"> | ||
<div class="value"> | ||
{{cpu_total_used}} | ||
</div> | ||
<div class="label"> | ||
总cpu使用核数 | ||
</div> | ||
</div> | ||
<div class="statistic"> | ||
<div class="value"> | ||
{{cpu_total_assigned}} | ||
</div> | ||
<div class="label"> | ||
已分配cpu数 | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{%extends "base.html"%} | ||
{%block custom-css%} | ||
|
||
<link rel="stylesheet" type="text/css" href="{{media_url}}/statistic.css"> | ||
<style> | ||
.my-container { | ||
background-color: rgb(247, 247, 249); | ||
border-radius: 1px; | ||
border-style: solid rgb(225, 225, 232) 1px; | ||
padding:3px; | ||
margin-bottom:5px; | ||
} | ||
</style> | ||
|
||
{%endblock%} | ||
{%block main%} | ||
<nav class="navbar navbar-toolbar navbar-default navbar-static-top"> | ||
<div class="container"> | ||
<div class="navbar-header"> | ||
<a class="navbar-brand" href="#">Galaxy</a> | ||
</div> | ||
<div id="navbar" class="navbar-collapse collapse"> | ||
<ul class="nav navbar-nav"> | ||
<li class="active"><a href="{{root_url}}dc">DataCenter</a></li> | ||
</ul> | ||
</div><!--/.nav-collapse --> | ||
</div> | ||
</nav> | ||
|
||
<div class="container my-container" id="real_time_stat"> | ||
|
||
</div> | ||
|
||
|
||
<div class="container my-container"> | ||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th>#</th> | ||
<th>name</th> | ||
<th>key</th> | ||
<th>master</th> | ||
<th>trace</th> | ||
</tr> | ||
</thead> | ||
{% for dc in dcs%} | ||
<tr> | ||
<td>{{forloop.counter}}</td> | ||
<td><a href="{{root_url}}trace/cluster?dc={{dc.dc}}&master={{dc.master}}&trace={{dc.trace}}">{{dc.name}}</a></td> | ||
<td>{{dc.dc}}</td> | ||
<td>{{dc.master}}</td> | ||
<td>{{dc.trace}}</td> | ||
</tr> | ||
{%endfor%} | ||
</table> | ||
</div> <!-- /container --> | ||
{%endblock%} | ||
|
||
{%block custom-js%} | ||
<script src="//code.highcharts.com/stock/highstock.js"></script> | ||
<script src="{{media_url}}/mustache.js"></script> | ||
<script> | ||
Number.prototype.padLeft = function(base,chr){ | ||
var len = (String(base || 10).length - String(this).length)+1; | ||
return len > 0? new Array(len).join(chr || '0')+this : this; | ||
} | ||
var ROOT_URL="{{root_url}}"; | ||
var MEDIA_URL="{{media_url}}"; | ||
var MASTER_LIST= new Array; | ||
{% for dc in dcs %} | ||
MASTER_LIST.push('{{dc.master}}'); | ||
{% endfor %} | ||
|
||
$(function(){ | ||
$.getJSON(ROOT_URL + "trace/dc",function(data){ | ||
var agent_total = 0; | ||
var cpu_total = 0; | ||
var cpu_total_used = 0; | ||
var cpu_total_assigned = 0; | ||
for (var index in data.data.status) { | ||
var dc = data.data.status[index]; | ||
agent_total += dc.agent_total; | ||
cpu_total += dc.cpu_total/1000; | ||
cpu_total_used += dc.cpu_used/1000; | ||
cpu_total_assigned += dc.cpu_assigned/1000; | ||
} | ||
cpu_total = Math.round(cpu_total); | ||
cpu_total_used = Math.round(cpu_total_used); | ||
cpu_total_assigned = Math.round(cpu_total_assigned); | ||
$.get(MEDIA_URL +"/tpl/agent.tpl", function(tpl){ | ||
var dc_info = Mustache.render(tpl,{cpu_total:cpu_total, | ||
agent_total:agent_total, | ||
cpu_total_assigned:cpu_total_assigned, | ||
cpu_total_used:cpu_total_used}); | ||
$("#real_time_stat").html(dc_info); | ||
}); | ||
}); | ||
}); | ||
</script> | ||
{%endblock%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.