Merge pull request #15 from FirmlyReality/display_quota
Display quota in Status page.
This commit is contained in:
commit
dae5d3874f
|
@ -342,7 +342,8 @@ class DockletHttpHandler(http.server.BaseHTTPRequestHandler):
|
||||||
res['mem_use'] = fetcher.get_mem_use(cmds[2])
|
res['mem_use'] = fetcher.get_mem_use(cmds[2])
|
||||||
elif cmds[3] == 'basic_info':
|
elif cmds[3] == 'basic_info':
|
||||||
res['basic_info'] = fetcher.get_basic_info(cmds[2])
|
res['basic_info'] = fetcher.get_basic_info(cmds[2])
|
||||||
self.response(200, {'success':'true', 'monitor':res})
|
user_info = G_usermgr.selfQuery(cur_user = cur_user)
|
||||||
|
self.response(200, {'success':'true', 'monitor':res, 'groupinfo':user_info['data']['groupinfo']})
|
||||||
elif cmds[1] == 'user':
|
elif cmds[1] == 'user':
|
||||||
if not user == 'root':
|
if not user == 'root':
|
||||||
self.response(400, {'success':'false', 'message':'Root Required'})
|
self.response(400, {'success':'false', 'message':'Root Required'})
|
||||||
|
|
|
@ -7,9 +7,9 @@ function processMemData(data)
|
||||||
mem_usedp = data.monitor.mem_use.usedp;
|
mem_usedp = data.monitor.mem_use.usedp;
|
||||||
var usedp = data.monitor.mem_use.usedp;
|
var usedp = data.monitor.mem_use.usedp;
|
||||||
var unit = data.monitor.mem_use.unit;
|
var unit = data.monitor.mem_use.unit;
|
||||||
var quota = data.monitor.mem_use.quota;
|
var quota = data.groupinfo.memory;
|
||||||
var val = data.monitor.mem_use.val;
|
var val = data.monitor.mem_use.val;
|
||||||
var out = "("+val+unit+"/"+quota+unit+")";
|
var out = "("+val+unit+"/"+quota+"MB)";
|
||||||
$("#con_mem").html((usedp/0.01).toFixed(2)+"%<br/>"+out);
|
$("#con_mem").html((usedp/0.01).toFixed(2)+"%<br/>"+out);
|
||||||
}
|
}
|
||||||
function getMemY()
|
function getMemY()
|
||||||
|
@ -21,7 +21,10 @@ function processCpuData(data)
|
||||||
cpu_usedp = data.monitor.cpu_use.usedp;
|
cpu_usedp = data.monitor.cpu_use.usedp;
|
||||||
var val = data.monitor.cpu_use.val;
|
var val = data.monitor.cpu_use.val;
|
||||||
var unit = data.monitor.cpu_use.unit;
|
var unit = data.monitor.cpu_use.unit;
|
||||||
|
var quota = data.groupinfo.cpu;
|
||||||
|
quota = quota/1000.0;
|
||||||
$("#con_cpu").html(val +" "+ unit);
|
$("#con_cpu").html(val +" "+ unit);
|
||||||
|
$("#con_cpuquota").html(quota.toFixed(2)+"% Cores");
|
||||||
}
|
}
|
||||||
function getCpuY()
|
function getCpuY()
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
<th>IP Address</th>
|
<th>IP Address</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Cpu used</th>
|
<th>Cpu used</th>
|
||||||
|
<th>Cpu quota</th>
|
||||||
<th>Mem used</th>
|
<th>Mem used</th>
|
||||||
<th>Summary</th>
|
<th>Summary</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -56,6 +57,7 @@
|
||||||
<td><div id='{{cluster}}_{{ loop.index }}_state' class="label label-primary">Running</div></td>
|
<td><div id='{{cluster}}_{{ loop.index }}_state' class="label label-primary">Running</div></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td id='{{cluster}}_{{ loop.index }}_cpu'>--</td>
|
<td id='{{cluster}}_{{ loop.index }}_cpu'>--</td>
|
||||||
|
<td id='{{cluster}}_{{ loop.index }}_cpuquota'>--</td>
|
||||||
<td id='{{cluster}}_{{ loop.index }}_mem'>--</td>
|
<td id='{{cluster}}_{{ loop.index }}_mem'>--</td>
|
||||||
|
|
||||||
<td><a class="btn btn-info btn-xs" href='/vclusters/{{ cluster }}/{{ container['containername'] }}/'>Realtime</a></td>
|
<td><a class="btn btn-info btn-xs" href='/vclusters/{{ cluster }}/{{ container['containername'] }}/'>Realtime</a></td>
|
||||||
|
@ -97,21 +99,25 @@
|
||||||
$("#"+index+"_pid").html('--');
|
$("#"+index+"_pid").html('--');
|
||||||
$("#"+index+"_ip").html('--');
|
$("#"+index+"_ip").html('--');
|
||||||
$("#"+index+"_cpu").html('--');
|
$("#"+index+"_cpu").html('--');
|
||||||
|
$("#"+index+"_cpuquota").html('--');
|
||||||
$("#"+index+"_mem").html('--');
|
$("#"+index+"_mem").html('--');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$.post(url+"/cpu_use",{},function(data){
|
$.post(url+"/cpu_use",{},function(data){
|
||||||
var usedp = data.monitor.cpu_use.usedp;
|
var usedp = data.monitor.cpu_use.usedp;
|
||||||
|
var quota = data.groupinfo.cpu;
|
||||||
|
quota = quota/100000.0;
|
||||||
$("#"+index+"_cpu").html((usedp/0.01).toFixed(2)+"%");
|
$("#"+index+"_cpu").html((usedp/0.01).toFixed(2)+"%");
|
||||||
|
$("#"+index+"_cpuquota").html((quota*100).toFixed(2)+"% Cores");
|
||||||
},"json");
|
},"json");
|
||||||
|
|
||||||
$.post(url+"/mem_use",{},function(data){
|
$.post(url+"/mem_use",{},function(data){
|
||||||
var usedp = data.monitor.mem_use.usedp;
|
var usedp = data.monitor.mem_use.usedp;
|
||||||
var unit = data.monitor.mem_use.unit;
|
var unit = data.monitor.mem_use.unit;
|
||||||
var quota = data.monitor.mem_use.quota;
|
var quota = data.groupinfo.memory;
|
||||||
var val = data.monitor.mem_use.val;
|
var val = data.monitor.mem_use.val;
|
||||||
var out = "("+val+unit+"/"+quota+unit+")";
|
var out = "("+val+unit+"/"+quota+"MB)";
|
||||||
$("#"+index+"_mem").html((usedp/0.01).toFixed(2)+"%<br/>"+out);
|
$("#"+index+"_mem").html((usedp/0.01).toFixed(2)+"%<br/>"+out);
|
||||||
},"json");
|
},"json");
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
<th>State</th>
|
<th>State</th>
|
||||||
<th>IP Address</th>
|
<th>IP Address</th>
|
||||||
<th>CPU Use</th>
|
<th>CPU Use</th>
|
||||||
|
<th>CPU Quota</th>
|
||||||
<th>Mem Use</th>
|
<th>Mem Use</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
@ -57,6 +58,7 @@
|
||||||
<td id='con_ip'>{{ container['IP'] }}</td>
|
<td id='con_ip'>{{ container['IP'] }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td id='con_cpu'>--</td>
|
<td id='con_cpu'>--</td>
|
||||||
|
<td id='con_cpuquota'>--</td>
|
||||||
<td id='con_mem'>--</td>
|
<td id='con_mem'>--</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
Loading…
Reference in New Issue