diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js b/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js index 92d81d97b2..5610cfebd1 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js +++ b/src/sunstone/public/app/tabs/vms-tab/panels/capacity.js @@ -110,25 +110,39 @@ define(function(require) { data: { id: that.element.ID, monitor: { - monitor_resources : "MONITORING/CPU,MONITORING/MEMORY" + monitor_resources : "MONITORING/CPU,TEMPLATE/CPU,MONITORING/MEMORY,TEMPLATE/MEMORY" } }, success: function(req, response) { var vmGraphs = [ { - monitor_resources : "MONITORING/CPU", - labels : Locale.tr("Real CPU"), + monitor_resources : "TEMPLATE/CPU,MONITORING/CPU", + labels : Locale.tr("Allocated") + "," + Locale.tr("Real"), humanize_figures : false, - div_graph : $(".vm_cpu_graph") + div_graph : $(".vm_cpu_graph", context), + div_legend : $(".vm_cpu_legend", context) }, { - monitor_resources : "MONITORING/MEMORY", - labels : Locale.tr("Real MEM"), + monitor_resources : "TEMPLATE/MEMORY,MONITORING/MEMORY", + labels : Locale.tr("Allocated") + "," + Locale.tr("Real"), humanize_figures : true, - div_graph : $(".vm_memory_graph") + div_graph : $(".vm_memory_graph", context), + div_legend : $(".vm_memory_legend", context) } ]; + if(response.monitoring["TEMPLATE/CPU"] != undefined){ + response.monitoring["TEMPLATE/CPU"].map(function(e){ + e[1] = e[1] * 100; + }); + } + + if(response.monitoring["TEMPLATE/MEMORY"] != undefined){ + response.monitoring["TEMPLATE/MEMORY"].map(function(e){ + e[1] = e[1] * 1024; + }); + } + for (var i = 0; i < vmGraphs.length; i++) { Graphs.plot(response, vmGraphs[i]); } diff --git a/src/sunstone/public/app/tabs/vms-tab/panels/capacity/html.hbs b/src/sunstone/public/app/tabs/vms-tab/panels/capacity/html.hbs index 74f033ef19..32d6064356 100644 --- a/src/sunstone/public/app/tabs/vms-tab/panels/capacity/html.hbs +++ b/src/sunstone/public/app/tabs/vms-tab/panels/capacity/html.hbs @@ -68,6 +68,9 @@ +
+
+
@@ -82,5 +85,8 @@
+
+
+
diff --git a/src/vm/VirtualMachine.cc b/src/vm/VirtualMachine.cc index be2556b78c..48c8a89fc5 100644 --- a/src/vm/VirtualMachine.cc +++ b/src/vm/VirtualMachine.cc @@ -1738,10 +1738,20 @@ int VirtualMachine::update_monitoring(SqlDB * db) string error_str; char * sql_xml; + float cpu = 0; + long long memory = 0; + + obj_template->get("CPU", cpu); + obj_template->get("MEMORY", memory); + oss << "" << "" << oid << "" << "" << last_poll << "" << monitoring.to_xml(xml_body) + << "" << ""; sql_xml = db->escape_str(oss.str().c_str());