2013-10-30 10:23:46 +00:00
|
|
|
<div class="box-header">
|
|
|
|
<h2>
|
|
|
|
<i class="icons-book-2"></i>
|
|
|
|
<span class="break"></span>
|
2013-11-04 09:45:01 +00:00
|
|
|
<%= t(:server_usage) %>
|
2013-10-30 10:23:46 +00:00
|
|
|
</h2>
|
|
|
|
</div>
|
2013-11-05 11:38:47 +00:00
|
|
|
<div class="box-content" style='overflow: hidden; text-align:center;'>
|
|
|
|
<div id="cpu_usage" class="pull-left" style="width:200px; height:160px; display: inline-block;"></div>
|
|
|
|
<div id="mem_usage" style="width:200px; height:160px; display: inline-block;"></div>
|
|
|
|
<div id="disk_usage" class="pull-right" style="width:200px; height:160px; display: inline-block;"></div>
|
2013-10-30 10:23:46 +00:00
|
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
2013-11-05 11:38:47 +00:00
|
|
|
var Gages = { 'CPU':{
|
|
|
|
'JustGage': null,
|
|
|
|
'container': 'cpu_usage',
|
|
|
|
'title': 'CPU Usage',
|
|
|
|
'fn': 'get_cpu_usage',
|
|
|
|
'update_interval': 2000
|
|
|
|
},
|
|
|
|
'Mem':{
|
|
|
|
'JustGage': null,
|
|
|
|
'container': 'mem_usage',
|
|
|
|
'title': 'Memory Usage',
|
|
|
|
'fn': 'get_mem_usage',
|
|
|
|
'update_interval': 10000
|
|
|
|
},
|
|
|
|
'Disk':{
|
|
|
|
'JustGage': null,
|
|
|
|
'container': 'disk_usage',
|
|
|
|
'title': 'Disk Usage',
|
|
|
|
'fn': 'get_disk_usage',
|
|
|
|
'update_interval': 30000
|
|
|
|
}
|
|
|
|
};
|
2013-10-30 10:23:46 +00:00
|
|
|
|
2013-11-04 09:45:01 +00:00
|
|
|
$(function () {
|
2013-11-05 11:38:47 +00:00
|
|
|
$.each(Gages,function(id,Gage){
|
|
|
|
Gage['JustGage'] = new JustGage({
|
|
|
|
id: Gage['container'],
|
|
|
|
value: 0,
|
|
|
|
min: 0,
|
|
|
|
max: 100,
|
|
|
|
title: Gage['title'],
|
|
|
|
shadowVerticalOffset: 10,
|
|
|
|
levelColors: ['#39D824','#FFC33F','#F51F1F'],
|
|
|
|
titleFontColor: '#666',
|
|
|
|
valueFontColor: '#666',
|
|
|
|
labelFontColor: '#666',
|
|
|
|
label: '%',
|
2013-11-06 01:29:57 +00:00
|
|
|
refreshAnimationTime: 800
|
2013-11-05 11:38:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
update_usage(Gage);
|
2013-10-30 10:23:46 +00:00
|
|
|
});
|
2013-11-04 09:45:01 +00:00
|
|
|
});
|
2013-10-30 10:23:46 +00:00
|
|
|
|
2013-11-05 11:38:47 +00:00
|
|
|
function update_usage(Gage){
|
|
|
|
$.get('/admin/dashboards/'+Gage['fn'],function(usage){
|
|
|
|
Gage['JustGage'].refresh(parseInt(usage));
|
2013-11-06 01:29:57 +00:00
|
|
|
setTimeout(function(){update_usage(Gage);},Gage['update_interval']);
|
2013-11-05 11:38:47 +00:00
|
|
|
});
|
2013-10-30 10:23:46 +00:00
|
|
|
}
|
2013-11-05 11:38:47 +00:00
|
|
|
|
2013-10-30 10:23:46 +00:00
|
|
|
</script>
|