--- misc/xenconsole/ajaxdata.php 2012/12/02 14:56:06 1891 +++ misc/xenconsole/ajaxdata.php 2012/12/02 16:30:24 1892 @@ -35,15 +35,24 @@ $mem_total = $host_metrics["memory_total"]; $mem_free = $host_metrics["memory_free"]; -$vms_array = $xenserver->VM__get_all_records(); +$cpus = $host["cpu_info"]["cpu_count"]; +$cpusum = 0.0; +for ($i=0; $i<$cpus; $i++) { + $cpusum += $xenserver->host__query_data_source($hosts_array[0], "cpu" . $i); +} +$cpuavg = round ( ($cpusum/$cpus) * 100); header("Content-Type: text/xml"); echo ""; echo ""; echo "{$mem_total}"; echo "{$mem_free}"; +echo "{$cpuavg}"; echo ""; + + +$vms_array = $xenserver->VM__get_all_records(); // List all machines foreach($vms_array as $vmref => $vm) { if ($vm["is_a_template"] != 0 || $vm["is_control_domain"] != 0) {