--- misc/xenconsole/ajaxdata.php 2012/11/30 17:56:07 1885 +++ misc/xenconsole/ajaxdata.php 2012/12/01 16:12:51 1889 @@ -27,11 +27,23 @@ /* Establish session with Xenserver */ $xenserver = new XenApi($url, $login, $password); + +$hosts_array = $xenserver->host__get_all(); +$host = $xenserver->host__get_record($hosts_array[0]); +$host_metrics = $xenserver->host_metrics__get_record($host["metrics"]); + +$mem_total = $host_metrics["memory_total"]; +$mem_free = $host_metrics["memory_free"]; + $vms_array = $xenserver->VM__get_all_records(); header("Content-Type: text/xml"); echo ""; +echo ""; +echo "{$mem_total}"; +echo "{$mem_free}"; +echo ""; // List all machines foreach($vms_array as $vm) { @@ -48,10 +60,12 @@ $network = ""; $url = ""; $session = ""; + $os = ""; if ( $vm["power_state"] == "Running" ) { if ($vm["guest_metrics"] != "OpaqueRef:NULL") {//guest tools installed $guest_metrics = $xenserver->VM_guest_metrics__get_record( $vm["guest_metrics"] ); $network = implode( ",", $guest_metrics["networks"]) ; + $os = $guest_metrics["os_version"]["name"]; } foreach($vm["consoles"] as $conref) { @@ -73,6 +87,7 @@ echo "{$network}"; echo "{$url}"; echo "{$session}"; + echo "{$os}"; echo ""; }