Add button to history page on status page.
This commit is contained in:
parent
1b3c12d936
commit
63a2d387bd
|
@ -208,15 +208,17 @@ class History(db.Model):
|
|||
id = db.Column(db.Integer, primary_key=True)
|
||||
vnode = db.Column(db.String(100), db.ForeignKey('v_node.name'))
|
||||
action = db.Column(db.String(30))
|
||||
runningtime = db.Column(db.Integer)
|
||||
cputime = db.Column(db.Float)
|
||||
billing = db.Column(db.Integer)
|
||||
actionTime = db.Column(db.DateTime)
|
||||
|
||||
def __init__(self, action, cputime, billing):
|
||||
def __init__(self, action, runningtime, cputime, billing):
|
||||
self.action = action
|
||||
self.runningtime = runningtime
|
||||
self.cputime = cputime
|
||||
self.billing = billing
|
||||
self.actionTime = datetime.now()
|
||||
|
||||
def __repr__(self):
|
||||
return "{\"id\":\"%d\",\"vnode\":\"%s\",\"action\":\"%s\",\"cputime\":\"%f\",\"billing\":\"%d\",\"actionTime\":\"%s\"}" % (self.id, self.vnode, self.action, self.cputime, self.billing, self.actionTime.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
return "{\"id\":\"%d\",\"vnode\":\"%s\",\"action\":\"%s\",\"runningtime\":\"%d\",\"cputime\":\"%f\",\"billing\":\"%d\",\"actionTime\":\"%s\"}" % (self.id, self.vnode, self.action, self.runningtime, self.cputime, self.billing, self.actionTime.strftime("%Y-%m-%d %H:%M:%S"))
|
||||
|
|
|
@ -27,7 +27,7 @@ class Container_Collector(threading.Thread):
|
|||
threading.Thread.__init__(self)
|
||||
self.thread_stop = False
|
||||
self.interval = 2
|
||||
self.billingtime = 3600
|
||||
self.billingtime = 30
|
||||
self.test = test
|
||||
self.cpu_last = {}
|
||||
self.cpu_quota = {}
|
||||
|
@ -620,7 +620,7 @@ class History_Manager:
|
|||
billing = 0
|
||||
cputime = 0.0
|
||||
runtime = 0
|
||||
history = History(action,cputime,billing)
|
||||
history = History(action,runtime,cputime,billing)
|
||||
vnode.histories.append(history)
|
||||
if action == 'Stop' or action == 'Create':
|
||||
laststopcpuval[vnode_name] = cputime
|
||||
|
|
|
@ -29,7 +29,7 @@ function processCpuData(data)
|
|||
if(is_running)
|
||||
{
|
||||
cpu_usedp = data.monitor.cpu_use.usedp;
|
||||
var val = data.monitor.cpu_use.val;
|
||||
var val = (data.monitor.cpu_use.val).toFixed(2);
|
||||
var unit = data.monitor.cpu_use.unit;
|
||||
var quota = data.monitor.cpu_use.quota.cpu;
|
||||
var quotaout = "("+quota;
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
{% extends 'base_AdminLTE.html' %}
|
||||
|
||||
{% block title %}Docklet | History{% endblock %}
|
||||
|
||||
{% block panel_title %}History for <div id='node_name'>{{ vnode_name }}</div>{% endblock %}
|
||||
|
||||
{% block panel_list %}
|
||||
<ol class="breadcrumb">
|
||||
<li>
|
||||
<a href="/dashboard/"><i class="fa fa-dashboard"></i>Home</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='/vclusters/'>VClusterStatus</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<strong>History</strong>
|
||||
</li>
|
||||
</ol>
|
||||
{% endblock %}
|
||||
|
||||
{% block css_src %}
|
||||
<link href="/static/dist/css/flotconfig.css" rel="stylesheet">
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="box box-info">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">History of {{ vnode_name }}</h3>
|
||||
|
||||
<div class="box-tools pull-right">
|
||||
<button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
|
||||
</button>
|
||||
<button type="button" class="btn btn-box-tool" data-widget="remove"><i class="fa fa-times"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-body table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>History ID</th>
|
||||
<th>Action</th>
|
||||
<th>Running Time</th>
|
||||
<th>Cpu Time</th>
|
||||
<th>Billing</th>
|
||||
<th>Action Time</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for record in history %}
|
||||
<tr>
|
||||
<th>{{ record['id'] }}</th>
|
||||
<th>{{ record['action'] }}</th>
|
||||
<th>{{ record['runningtime'] }} seconds</th>
|
||||
<th>{{ record['cputime'] }} seconds</th>
|
||||
<th>{{ record['billing'] }} beans</th>
|
||||
<th>{{ record['actionTime'] }}</th>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
@ -112,7 +112,7 @@
|
|||
}
|
||||
|
||||
$.post(url+"/cpu_use/",{},function(data){
|
||||
var val = data.monitor.cpu_use.val;
|
||||
var val = (data.monitor.cpu_use.val).toFixed(2);
|
||||
var unit = data.monitor.cpu_use.unit;
|
||||
var hostpercent = data.monitor.cpu_use.hostpercent;
|
||||
var percent = (hostpercent*100).toFixed(2);
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
<th>Disk Usage</th>
|
||||
<th>Billing</th>
|
||||
<th>Summary</th>
|
||||
<th>History</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
@ -108,6 +109,7 @@
|
|||
<td id='{{cluster}}_{{ loop.index }}_disk'>--</td>
|
||||
<td id='{{cluster}}_{{ loop.index }}_billing'>--</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'] }}/history/'>History</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
|
|
Loading…
Reference in New Issue