1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-19 06:50:07 +03:00

Feature #1098: Add net_tx y net_rx accouting plots to sunstone and selfservice.

When the requested dates is 1 day, set interval in 1 hour. Otherwise set interval in 1 day
(cherry picked from commit 834ae97bb4727086a7d8d2f338f31cedad1085f2)
This commit is contained in:
Hector Sanjuan 2012-08-31 14:42:57 +02:00 committed by Ruben S. Montero
parent e6dad7ab3e
commit f059357908
4 changed files with 38 additions and 2 deletions

View File

@ -22,6 +22,10 @@ var user_acct_graphs = [
{ title : tr("Memory"),
monitor_resources : "MEMORY",
humanize_figures : true
},
{ title : tr("Net transfer rates"),
monitor_resources : "NETTX,NETRX",
humanize_figures : true
}
];
@ -93,6 +97,15 @@ var dashboard_tab_content =
</td>\
</tr>\
</table>\
<table class="info_table">\
<tr><td id="legend_NETTX_NETRX"></td></tr>\
<tr><td style="border:0;width:800px!important;">\
<div id="user_acct_NETTX_NETRX" style="height:100px;position:relative;left:0px;overflow: hidden;">'+
spinner+
'</div>\
</td>\
</tr>\
</table>\
\
</div>\
</div>\

View File

@ -27,6 +27,14 @@ var group_acct_graphs = [
{ title : tr("Memory"),
monitor_resources : "MEMORY",
humanize_figures : true
},
{ title : tr("Net TX"),
monitor_resources : "NETTX",
humanize_figures : true
},
{ title : tr("Net RX"),
monitor_resources : "NETRX",
humanize_figures : true
}
];

View File

@ -29,6 +29,14 @@ var user_acct_graphs = [
{ title : tr("Memory"),
monitor_resources : "MEMORY",
humanize_figures : true
},
{ title : tr("Net TX"),
monitor_resources : "NETTX",
humanize_figures : true
},
{ title : tr("Net RX"),
monitor_resources : "NETRX",
humanize_figures : true
}
];

View File

@ -1231,10 +1231,17 @@ function progressBar(value, opts){
}
function loadAccounting(resource, id, graphs, options){
var secs_in_day = 3600 * 24;
var now = Math.floor(new Date().getTime() / 1000)
var start = options && options.start ? options.start : now - (3600 * 24);
var start = options && options.start ? options.start : now - secs_in_day;
var end = options && options.end ? options.end : now;
var interval = options && options.interval ? options.interval : 60 * 60;
var interval;
if (options && options.interval){
interval = options.interval;
} else {
//If we are asking more than one interval is one day, otherwise 1 hour
interval = (end - start) > secs_in_day ? secs_in_day : 3600;
}
for (var i = 0; i < graphs.length; i++){
var graph_cfg = graphs[i];